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

Re: svn commit: r1663760 - svn_hash_sets() type checking

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Wed, 4 Mar 2015 09:03:44 +0000

Daniel Shahaf wrote:
>> URL: http://svn.apache.org/r1663760
[...]
>> -#define svn_hash_sets(ht, key, val) \
>> - apr_hash_set(ht, key, APR_HASH_KEY_STRING, val)
>> +#define svn_hash_sets(ht, key, val) \
>> + do { [...] } while (0)
>
> Strictly speaking, that's a backwards-incompatible change. Since the
> new definition is no longer an rvalue, API consumers' code would break
> if they used svn_hash_sets() as part of a statement. Example:
>
> /* This works with svn 1.8. */
> #include <subversion-1/svn_hash.h>
> #define my_foo() (svn_hash_sets(h, s), 42)
>
> I think we have to either errata this, or restore svn_hash_gets()'
> previous definition and name the do-while version svn_hash_gets2().
>
> Makes sense?

Yes... but a nicer solution would be to define it the same way as I defined *get* (forward through a private function), wouldn't it? That would restore a symmetry that Brane pointed out was surprisingly missing.

r1663896.

- Julian
Received on 2015-03-04 10:04:34 CET

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