You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Madan U S <ma...@collab.net> on 2006/04/05 12:58:04 UTC

RE: svn commit: r19183 - trunk/subversion/libsvn_wc

On Wednesday 05 Apr 2006 5:47 pm, lundblad@tigris.org wrote:
> Author: lundblad
> Date: Wed Apr  5 05:17:56 2006
> New Revision: 19183
>
> Modified:
>    trunk/subversion/libsvn_wc/entries.c
>    trunk/subversion/libsvn_wc/entries.h
[snip]
> Modified: trunk/subversion/libsvn_wc/entries.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/entries.c?pathr
>ev=19183&r1=19182&r2=19183
> ===========================================================================
>=== --- trunk/subversion/libsvn_wc/entries.c	(original)
> +++ trunk/subversion/libsvn_wc/entries.c	Wed Apr  5 05:17:56 2006
> @@ -157,6 +157,9 @@
>
>    /* Don't leave home without one. */
>    apr_pool_t *pool;
> +
> +  /* Cleared before handling each entry. */
> +  apr_pool_t *scratch_pool;
>  };
>
>
> @@ -220,7 +223,7 @@
>      if (name && strcmp(name, "svn:this_dir") == 0)
>        name = SVN_WC_ENTRY_THIS_DIR;
>    }
> -  entry->name = name ? name : SVN_WC_ENTRY_THIS_DIR;
> +  entry->name = name ? apr_pstrdup(pool, name) : SVN_WC_ENTRY_THIS_DIR;
>
>    /* Attempt to set revision (resolve_to_defaults may do it later, too) */
>    {
> @@ -242,7 +245,10 @@
>        = apr_hash_get(atts, SVN_WC__ENTRY_ATTR_URL, APR_HASH_KEY_STRING);
>
>      if (entry->url)
> -      *modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
> +      {
> +        *modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
> +        entry->url = apr_pstrdup(pool, entry->url);

sorry, I dont understand why this is done... could you pl. explain this, lundblad? (There are other similar usages of apr_pstrdup() in the rest of the diff, but am taking this as an example)

Regards,
Madan.

Re: svn commit: r19183 - trunk/subversion/libsvn_wc

Posted by "C. Michael Pilato" <cm...@collab.net>.
Madan U S wrote:
>> @@ -242,7 +245,10 @@
>>        = apr_hash_get(atts, SVN_WC__ENTRY_ATTR_URL, APR_HASH_KEY_STRING);
>>
>>      if (entry->url)
>> -      *modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
>> +      {
>> +        *modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
>> +        entry->url = apr_pstrdup(pool, entry->url);
> 
> sorry, I dont understand why this is done... could you pl. explain this,
> lundblad? (There are other similar usages of apr_pstrdup() in the rest
> of the diff, but am taking this as an example)

Now that Peter made the bulk of this entry cache reading stuff use a
temporary "scratch_pool", he needs to copy select bits of information from
that pool and into the longer-lived "pool" so that they survive beyond his
clearing of the "scratch_pool".  And he's cleverly just updating the
structure members (such as entry->url) from pointing to data-in-scratch-pool
to pointing to data-in-pool instead of futzing with both a structure named
"entry" and one named "scratch_entry" (or the likes).


-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand