subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@wandisco.com>
Subject 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
Date Tue, 28 Oct 2014 16:26:40 GMT
On 28.10.2014 17:17, breser@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

Mime
View raw message