julianf...@apache.org wrote on Tue, Mar 03, 2015 at 18:09:32 -0000: > Author: julianfoad > Date: Tue Mar 3 18:09:32 2015 > New Revision: 1663760 > > URL: http://svn.apache.org/r1663760 > Log: > Redefine the svn_hash_gets and svn_hash_sets macros in a way that allows for > parameter type checking, at least in debug builds. > > /** Shortcut for apr_hash_set() with a const char * key. > * > * @since New in 1.8. > */ > -#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 { \ > + const char *svn_hash__key = (key); \ > + apr_hash_set(ht, svn_hash__key, APR_HASH_KEY_STRING, val); \ > + } 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? Cheers, Daniel