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

Re: svn commit: r1459058 - in /subversion/trunk/subversion: include/private/svn_dep_compat.h include/private/svn_subr_private.h libsvn_ra_serf/serf.c libsvn_subr/hash.c libsvn_wc/adm_ops.c svn/notify.c svnrdump/dump_editor.c

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 21 Mar 2013 13:18:43 +0000

julianfoad_at_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?

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download
Received on 2013-03-21 14:19:32 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.