On 21.03.2013 14:18, Philip Martin wrote: > julianf...@apache.org writes: > >> Author: julianfoad >> Date: Wed Mar 20 21:14:59 2013 >> New Revision: 1459058 >> --- subversion/trunk/subversion/include/private/svn_dep_compat.h (original) >> +++ subversion/trunk/subversion/include/private/svn_dep_compat.h Wed Mar 20 >> 21:14:59 2013 >> @@ -62,6 +62,15 @@ extern "C" { >> #define apr_array_clear(arr) (arr)->nelts = 0 >> #endif >> >> +/** >> + * If we don't have a recent enough APR, emulate the behavior of the >> + * apr_hash_clear() API. >> + */ >> +#if !APR_VERSION_AT_LEAST(1,3,0) >> +void svn_hash__clear(struct apr_hash_t *ht); >> +#define apr_hash_clear(ht) svn_hash__clear(ht) >> +#endif >> + >> #if !APR_VERSION_AT_LEAST(1,0,0) >> #define APR_UINT64_C(val) UINT64_C(val) >> #define APR_FPROT_OS_DEFAULT APR_OS_DEFAULT >> --- subversion/trunk/subversion/libsvn_subr/hash.c (original) >> +++ subversion/trunk/subversion/libsvn_subr/hash.c Wed Mar 20 21:14:59 2013 >> @@ -508,8 +508,8 @@ svn_hash_from_cstring_keys(apr_hash_t ** >> } >> >> >> -svn_error_t * >> -svn_hash__clear(apr_hash_t *hash, apr_pool_t *pool) >> +void >> +svn_hash__clear(apr_hash_t *hash) >> { >> #if APR_VERSION_AT_LEAST(1, 3, 0) >> apr_hash_clear(hash); >> @@ -518,13 +518,12 @@ svn_hash__clear(apr_hash_t *hash, apr_po >> const void *key; >> apr_ssize_t klen; >> >> - for (hi = apr_hash_first(pool, hash); hi; hi = apr_hash_next(hi)) >> + for (hi = apr_hash_first(NULL, hash); hi; hi = apr_hash_next(hi)) >> { >> apr_hash_this(hi, &key, &klen, NULL); >> apr_hash_set(hash, key, klen, NULL); >> } >> #endif >> - return SVN_NO_ERROR; >> } >> > The declaration of svn_hash__clear is only present for old APR while the > definition is always visible. I get this warning: > > ../src2/subversion/libsvn_subr/hash.c:512:1: warning: no previous prototype > for 'svn_hash__clear' [-Wmissing-prototypes] > > We could fix it by moving the declaration outside the #if making > svn_hash__clear always available. Or we could wrap the definition in a > #if (dropping the call to apr_hash_clear) so it is only available when > the declaration is available. > > Which is the best solution?
Given that this is an internal API and not subject to compatibility across patch releases, I think we can safely make the implementation conditional on the same predicate. -- Brane -- Branko Čibej Director of Subversion | WANdisco | www.wandisco.com