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

Re: svn commit: r39768 - trunk/subversion/libsvn_fs_fs

From: Greg Stein <gstein_at_gmail.com>
Date: Wed, 7 Oct 2009 20:52:02 -0400

On Fri, Oct 2, 2009 at 13:22, Hyrum K. Wright <hyrum_at_hyrumwright.org> wrote:
>...
> +++ trunk/subversion/libsvn_fs_fs/fs_fs.c       Fri Oct  2 10:22:06 2009        (r39768)
>...
> @@ -6185,18 +6172,17 @@ recover_find_max_ids(svn_fs_t *fs, svn_r
>   iterpool = svn_pool_create(pool);
>   for (hi = apr_hash_first(NULL, entries); hi; hi = apr_hash_next(hi))
>     {
> -      void *val;
>       char *str_val;
>       char *str, *last_str;
>       svn_node_kind_t kind;
>       svn_fs_id_t *id;
>       const char *node_id, *copy_id;
>       apr_off_t child_dir_offset;
> +      const char *path = svn_apr_hash_index_val(hi);
>
>       svn_pool_clear(iterpool);
>
> -      apr_hash_this(hi, NULL, NULL, &val);
> -      str_val = apr_pstrdup(iterpool, *((char **)val));
> +      str_val = apr_pstrdup(iterpool, path);

This is an incorrect transformation.

The original code was being "too smart" and knew that val was an
svn_string_t* and that val->data is the first member, thus deref'ing a
char** would be equivalent to fetching val->data.

So. You want something like:

  svn_string_t *path = svn_apr_hash_index_val(hi);
...
  str_val = apr_pstrdup(iterpool, path->data);

As it stands, you're dup'ing the svn_string_t structure itself.

>...

Cheers,
-g

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2404752
Received on 2009-10-08 02:52:10 CEST

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.