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 2009/07/07 13:08:00 UTC

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

What freed memory? I don't see where that occurred...

On Thu, May 28, 2009 at 05:28, Hyrum K. Wright<hy...@hyrumwright.org> wrote:
> Author: hwright
> Date: Wed May 27 20:28:39 2009
> New Revision: 37871
>
> Log:
> Slight optimization and correctness fix in followup to r37870.
> Optimization: Combine a couple of loops.
> Correctness Fix: Stop referencing freed memory.
>
> * subversion/libsvn_wc/entries.c
>  (entries_write_body): Combine the two loops.
>
> Modified:
>   trunk/subversion/libsvn_wc/entries.c
>
> Modified: trunk/subversion/libsvn_wc/entries.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/entries.c?pathrev=37871&r1=37870&r2=37871
> ==============================================================================
> --- trunk/subversion/libsvn_wc/entries.c        Wed May 27 15:44:14 2009        (r37870)
> +++ trunk/subversion/libsvn_wc/entries.c        Wed May 27 20:28:39 2009        (r37871)
> @@ -2445,6 +2445,7 @@ entries_write_body(svn_wc__db_t *db,
>       const void *key;
>       void *val;
>       const svn_wc_entry_t *this_entry;
> +      const char *child_abspath;
>
>       svn_pool_clear(iterpool);
>
> @@ -2457,26 +2458,18 @@ entries_write_body(svn_wc__db_t *db,
>         continue;
>
>       /* Write the entry. */
> +      child_abspath = svn_dirent_join(local_abspath, key, iterpool);
>       SVN_ERR(write_entry(db, wc_db, wc_id, repos_id, repos_root,
> -                          this_entry, key,
> -                          svn_dirent_join(local_abspath, key, iterpool),
> -                          this_dir, iterpool));
> -    }
> -
> -  for (hi = apr_hash_first(scratch_pool, dav_cache); hi;
> -        hi = apr_hash_next(hi))
> -    {
> -      const void *key;
> -      void *val;
> -      const char *child_abspath;
> -
> -      svn_pool_clear(iterpool);
> -      apr_hash_this(hi, &key, NULL, &val);
> -      child_abspath = key;
> -      child_cache = val;
> +                          this_entry, key, child_abspath, this_dir, iterpool));
>
> -      SVN_ERR(svn_wc__db_base_set_dav_cache(db, child_abspath, child_cache,
> -                                            iterpool));
> +      /* Write the dav cache.
> +         ### This can go away when we stop unconditionally deleting all
> +         ### the entries before writing them (see comments above). */
> +      child_cache = apr_hash_get(dav_cache, child_abspath,
> +                                 APR_HASH_KEY_STRING);
> +      if (child_cache)
> +        SVN_ERR(svn_wc__db_base_set_dav_cache(db, child_abspath, child_cache,
> +                                              iterpool));
>     }
>
>   svn_pool_destroy(iterpool);
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2356019
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2368818


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

Posted by "Hyrum K. Wright" <hy...@hyrumwright.org>.
I've spent the last 30 minutes trying to figure out why I thought  
there was a memory error there, but for the life of me, I can't.  At  
this point, I guess I'm fixing bugs which don't even exist.

-Hyrum

On Jul 7, 2009, at 8:08 AM, Greg Stein wrote:

> What freed memory? I don't see where that occurred...
>
> On Thu, May 28, 2009 at 05:28, Hyrum K.  
> Wright<hy...@hyrumwright.org> wrote:
>> Author: hwright
>> Date: Wed May 27 20:28:39 2009
>> New Revision: 37871
>>
>> Log:
>> Slight optimization and correctness fix in followup to r37870.
>> Optimization: Combine a couple of loops.
>> Correctness Fix: Stop referencing freed memory.
>>
>> * subversion/libsvn_wc/entries.c
>>  (entries_write_body): Combine the two loops.
>>
>> Modified:
>>   trunk/subversion/libsvn_wc/entries.c
>>
>> Modified: trunk/subversion/libsvn_wc/entries.c
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/entries.c?pathrev=37871&r1=37870&r2=37871
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- trunk/subversion/libsvn_wc/entries.c        Wed May 27 15:44:14  
>> 2009        (r37870)
>> +++ trunk/subversion/libsvn_wc/entries.c        Wed May 27 20:28:39  
>> 2009        (r37871)
>> @@ -2445,6 +2445,7 @@ entries_write_body(svn_wc__db_t *db,
>>       const void *key;
>>       void *val;
>>       const svn_wc_entry_t *this_entry;
>> +      const char *child_abspath;
>>
>>       svn_pool_clear(iterpool);
>>
>> @@ -2457,26 +2458,18 @@ entries_write_body(svn_wc__db_t *db,
>>         continue;
>>
>>       /* Write the entry. */
>> +      child_abspath = svn_dirent_join(local_abspath, key, iterpool);
>>       SVN_ERR(write_entry(db, wc_db, wc_id, repos_id, repos_root,
>> -                          this_entry, key,
>> -                          svn_dirent_join(local_abspath, key,  
>> iterpool),
>> -                          this_dir, iterpool));
>> -    }
>> -
>> -  for (hi = apr_hash_first(scratch_pool, dav_cache); hi;
>> -        hi = apr_hash_next(hi))
>> -    {
>> -      const void *key;
>> -      void *val;
>> -      const char *child_abspath;
>> -
>> -      svn_pool_clear(iterpool);
>> -      apr_hash_this(hi, &key, NULL, &val);
>> -      child_abspath = key;
>> -      child_cache = val;
>> +                          this_entry, key, child_abspath,  
>> this_dir, iterpool));
>>
>> -      SVN_ERR(svn_wc__db_base_set_dav_cache(db, child_abspath,  
>> child_cache,
>> -                                            iterpool));
>> +      /* Write the dav cache.
>> +         ### This can go away when we stop unconditionally  
>> deleting all
>> +         ### the entries before writing them (see comments above).  
>> */
>> +      child_cache = apr_hash_get(dav_cache, child_abspath,
>> +                                 APR_HASH_KEY_STRING);
>> +      if (child_cache)
>> +        SVN_ERR(svn_wc__db_base_set_dav_cache(db, child_abspath,  
>> child_cache,
>> +                                              iterpool));
>>     }
>>
>>   svn_pool_destroy(iterpool);
>>
>> ------------------------------------------------------
>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2356019
>>
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2368818

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2368862