[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [RFC] New macro SVN_WC__DB_WITH_TXN(my_func_call(...)) doesn't need a baton

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 18 Dec 2012 16:26:47 +0000 (GMT)

I (Julian Foad) wrote:

> The "call a function within a transaction" paradigm is used heavily in
> wc_db.c.  [...]  To simplify it, we can write a statement
> macro that takes a complete, arbitrary function call as an argument. 
> [...] Then the usage looks like this:
>
>   /* ... */
>   static svn_error_t *db_base_remove(param1,
>                                      param2,
>                                      ...,
>                                      scratch_pool)
>   {
>     ... param1 ...
>   }
>
>   In the caller:
>   {
>     SVN_WC__DB_WITH_TXN(wcroot,
>       db_base_remove(param1, param2, ..., scratch_pool));
>   }
[...]
> I would prefer to be working with the simpler style of code, so I would like to
> introduce and use this macro.

I will point out that there are also some places where the current use of a baton still makes sense, notably for these three functions:

  insert_base_node()
  insert_external_node()
  insert_working_node()

where the baton contains a set of logically related information about the node rather than things that would make sense to be function parameters.  Using the new macro for these while keeping the baton will enable type checking of the baton type but nothing major.

> What does anybody think of introducing this form, in principle and in practice?

If there are no objections in a day or so, I'll finish the patch and commit it.

- Julian
Received on 2012-12-18 17:27:36 CET

This is an archived mail posted to the Subversion Dev mailing list.