subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hyrum K Wright <hyrum.wri...@wandisco.com>
Subject Re: svn commit: r1331652 - /subversion/trunk/subversion/libsvn_delta/compat.c
Date Tue, 01 May 2012 03:31:58 GMT
On Mon, Apr 30, 2012 at 10:02 PM, Greg Stein <gstein@gmail.com> wrote:
>
> On Apr 30, 2012 9:38 PM, "Hyrum K Wright" <hyrum.wright@wandisco.com> wrote:
>>...
>
>
>> > +/* Insert a new change for RELPATH, or return an existing one.  */
>> > +static struct change_node *
>> > +insert_change(const char *relpath,
>> > +              apr_hash_t *changes)
>> > +{
>> > +  apr_pool_t *result_pool;
>> > +  struct change_node *change;
>> > +
>> > +  change = apr_hash_get(changes, relpath, APR_HASH_KEY_STRING);
>> > +  if (change != NULL)
>> > +    return change;
>> > +
>> > +  result_pool = apr_hash_pool_get(changes);
>> > +
>> > +  /* Return an empty change. Callers will tweak as needed.  */
>> > +  change = apr_pcalloc(result_pool, sizeof(*change));
>> > +  change->changing = SVN_INVALID_REVNUM;
>> > +  change->deleting = SVN_INVALID_REVNUM;
>> > +
>> > +  apr_hash_set(changes, relpath, APR_HASH_KEY_STRING, change);
>>
>> As the key of the hash, RELPATH should be duplicated into a pool with
>> sufficient lifetime.
>
> Good catch! Fixed in r1332508.

Thanks.  For the same reason, you probably want to
s/apr_hash_copy/svn_prop_hash_dup/ over compat.c.  The former only
duplicates the hash, not the keys or the contents, while the latter
will ensure the prophash has the same lifetime as the change it
belongs to.

-Hyrum



-- 

uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/

Mime
View raw message