On 28.10.2014 17:17, bre...@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

Reply via email to