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

Re: svn commit: r1634906 - in /subversion/branches/svn-auth-x509/subversion: include/svn_x509.h libsvn_subr/x509.h libsvn_subr/x509info.c libsvn_subr/x509parse.c svn/auth-cmd.c tests/libsvn_subr/x509-test.c

From: Branko Čibej <brane_at_wandisco.com>
Date: Tue, 28 Oct 2014 17:26:40 +0100

On 28.10.2014 17:17, breser_at_apache.org wrote:
> Author: breser
> Date: Tue Oct 28 16:17:47 2014
> New Revision: 1634906

[...]

> +static apr_array_header_t *
> +deep_copy_array(apr_array_header_t *s, apr_pool_t *result_pool)
> +{
> + int i;
> + apr_array_header_t *d;
> +
> + if (!s)
> + return NULL;
> +
> + d = apr_array_copy(result_pool, s);
> +
> + /* Make a deep copy of the strings in the array. */
> + for (i = 0; i < s->nelts; ++i)
> + APR_ARRAY_IDX(d, i, const char *) =
> + apr_pstrdup(result_pool,
> + APR_ARRAY_IDX(s, i, const char *));
> +
> + return d;
> +}

Indentation is wrong. And I suggest using svn_iter_apr_array here.

> +
> +static apr_hash_t *deep_copy_hash(apr_hash_t *s,
> + apr_pool_t *scratch_pool,
> + apr_pool_t *result_pool)
> +{
> + apr_hash_t *d;
> + apr_hash_index_t *i;
> +
> + if (!s)
> + return NULL;
> +
> + d = apr_hash_make(result_pool);
> + i = apr_hash_first(scratch_pool, s);
> +
> + /* Make a deep copy of the hash keys and values. */
> + while (i)
> + {
> + const void *key;
> + void *val;
> + apr_ssize_t klen;
> +
> + apr_hash_this(i, &key, &klen, &val);
> + apr_hash_set(d, apr_pstrndup(result_pool, key, klen), klen,
> + apr_pstrdup(result_pool, val));
> + i = apr_hash_next(i);
> + }
> +
> + return d;
> +}

... and svn_iter_apr_hash here.

-- Brane
Received on 2014-10-28 17:27:58 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.