You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@gmail.com> on 2011/04/13 20:30:11 UTC

Re: svn commit: r1091728 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/commit_util.c libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db.h

On Wed, Apr 13, 2011 at 06:17,  <rh...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_client/commit_util.c Wed Apr 13 10:17:21 2011
> @@ -661,29 +661,24 @@ harvest_committables(svn_wc_context_t *w
>     {
>       apr_hash_t *local_relpath_tokens;
>       apr_hash_index_t *hi;
> +      apr_pool_t *token_pool = apr_hash_pool_get(lock_tokens);
>
>       SVN_ERR(svn_wc__node_get_lock_tokens_recursive(
>                   &local_relpath_tokens, wc_ctx, local_abspath,
> -                  scratch_pool, scratch_pool));
> +                  token_pool, scratch_pool));
>
> -      /* Map local_relpaths to URLs. */
> +      /* Add tokens to existing hash. */
>       for (hi = apr_hash_first(scratch_pool, local_relpath_tokens);
>            hi;
>            hi = apr_hash_next(hi))

This loop can be removed in favor of apr_hash_overlay().

>...

Cheers,
-g

Re: svn commit: r1091728 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/commit_util.c libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db.h

Posted by Greg Stein <gs...@gmail.com>.
On Wed, Apr 13, 2011 at 15:07, Bert Huijben <be...@qqmail.nl> wrote:
>
>
>> -----Original Message-----
>> From: Greg Stein [mailto:gstein@gmail.com]
>> Sent: woensdag 13 april 2011 20:30
>> To: dev@subversion.apache.org
>> Subject: Re: svn commit: r1091728 - in /subversion/trunk/subversion:
>> include/private/svn_wc_private.h libsvn_client/commit_util.c libsvn_wc/wc-
>> queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db.h
>>
>> On Wed, Apr 13, 2011 at 06:17,  <rh...@apache.org> wrote:
>> >...
>> > +++ subversion/trunk/subversion/libsvn_client/commit_util.c Wed Apr 13
>> 10:17:21 2011
>> > @@ -661,29 +661,24 @@ harvest_committables(svn_wc_context_t *w
>> >     {
>> >       apr_hash_t *local_relpath_tokens;
>> >       apr_hash_index_t *hi;
>> > +      apr_pool_t *token_pool = apr_hash_pool_get(lock_tokens);
>> >
>> >       SVN_ERR(svn_wc__node_get_lock_tokens_recursive(
>> >                   &local_relpath_tokens, wc_ctx, local_abspath,
>> > -                  scratch_pool, scratch_pool));
>> > +                  token_pool, scratch_pool));
>> >
>> > -      /* Map local_relpaths to URLs. */
>> > +      /* Add tokens to existing hash. */
>> >       for (hi = apr_hash_first(scratch_pool, local_relpath_tokens);
>> >            hi;
>> >            hi = apr_hash_next(hi))
>>
>> This loop can be removed in favor of apr_hash_overlay().
>
> /**
>  * Merge two hash tables into one new hash table. The values of the overlay
>  * hash override the values of the base if both have the same key.  Both
>  * hash tables must use the same hash function.
>  * @param p The pool to use for the new hash table
>  * @param overlay The table to add to the initial table
>  * @param base The table that represents the initial values of the new table
>  * @return A new hash table containing all of the data from the two passed
> in
>  */
> APR_DECLARE(apr_hash_t *) apr_hash_overlay(apr_pool_t *p,
>                                           const apr_hash_t *overlay,
>                                           const apr_hash_t *base);
>
> This function returns a new apr_hash_t *, while the caller of this function
> expects us to update the existing hashtable.

Ah! Good point. Thanks!

RE: svn commit: r1091728 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/commit_util.c libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db.h

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: Greg Stein [mailto:gstein@gmail.com]
> Sent: woensdag 13 april 2011 20:30
> To: dev@subversion.apache.org
> Subject: Re: svn commit: r1091728 - in /subversion/trunk/subversion:
> include/private/svn_wc_private.h libsvn_client/commit_util.c libsvn_wc/wc-
> queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db.h
> 
> On Wed, Apr 13, 2011 at 06:17,  <rh...@apache.org> wrote:
> >...
> > +++ subversion/trunk/subversion/libsvn_client/commit_util.c Wed Apr 13
> 10:17:21 2011
> > @@ -661,29 +661,24 @@ harvest_committables(svn_wc_context_t *w
> >     {
> >       apr_hash_t *local_relpath_tokens;
> >       apr_hash_index_t *hi;
> > +      apr_pool_t *token_pool = apr_hash_pool_get(lock_tokens);
> >
> >       SVN_ERR(svn_wc__node_get_lock_tokens_recursive(
> >                   &local_relpath_tokens, wc_ctx, local_abspath,
> > -                  scratch_pool, scratch_pool));
> > +                  token_pool, scratch_pool));
> >
> > -      /* Map local_relpaths to URLs. */
> > +      /* Add tokens to existing hash. */
> >       for (hi = apr_hash_first(scratch_pool, local_relpath_tokens);
> >            hi;
> >            hi = apr_hash_next(hi))
> 
> This loop can be removed in favor of apr_hash_overlay().

/**
 * Merge two hash tables into one new hash table. The values of the overlay
 * hash override the values of the base if both have the same key.  Both
 * hash tables must use the same hash function.
 * @param p The pool to use for the new hash table
 * @param overlay The table to add to the initial table
 * @param base The table that represents the initial values of the new table
 * @return A new hash table containing all of the data from the two passed
in
 */
APR_DECLARE(apr_hash_t *) apr_hash_overlay(apr_pool_t *p,
                                           const apr_hash_t *overlay, 
                                           const apr_hash_t *base);

This function returns a new apr_hash_t *, while the caller of this function
expects us to update the existing hashtable.

	Bert