You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/06/23 20:29:40 UTC

svn commit: r1604902 - in /subversion/trunk/subversion/libsvn_fs_fs: cached_data.c low_level.c low_level.h

Author: stsp
Date: Mon Jun 23 18:29:40 2014
New Revision: 1604902

URL: http://svn.apache.org/r1604902
Log:
Switch svn_fs_fs__read_changes() to the dual-pool idiom.

* subversion/libsvn_fs_fs/cached_data.c
  (svn_fs_fs__get_changes, block_read_changes): Pass a scratch_pool.

* subversion/libsvn_fs_fs/low_level.c
  (svn_fs_fs__read_changes): Switch to dual-pool. Use scratch pool
   for temporary allocations.

* subversion/libsvn_fs_fs/low_level.h
  (svn_fs_fs__read_changes): Tweak declaration and docstring.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
    subversion/trunk/subversion/libsvn_fs_fs/low_level.c
    subversion/trunk/subversion/libsvn_fs_fs/low_level.h

Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/cached_data.c?rev=1604902&r1=1604901&r2=1604902&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Mon Jun 23 18:29:40 2014
@@ -2717,7 +2717,7 @@ svn_fs_fs__get_changes(apr_array_header_
           SVN_ERR(aligned_seek(fs, revision_file->file, NULL, changes_offset,
                                scratch_pool));
           SVN_ERR(svn_fs_fs__read_changes(changes, revision_file->stream,
-                                          result_pool));
+                                          result_pool, scratch_pool));
 
           /* cache for future reference */
 
@@ -3104,7 +3104,8 @@ block_read_changes(apr_array_header_t **
 
   /* read changes from revision file */
 
-  SVN_ERR(svn_fs_fs__read_changes(changes, stream, result_pool));
+  SVN_ERR(svn_fs_fs__read_changes(changes, stream, result_pool,
+                                  scratch_pool));
 
   /* cache for future reference */
 

Modified: subversion/trunk/subversion/libsvn_fs_fs/low_level.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/low_level.c?rev=1604902&r1=1604901&r2=1604902&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/low_level.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/low_level.c Mon Jun 23 18:29:40 2014
@@ -383,20 +383,22 @@ read_change(change_t **change_p,
 svn_error_t *
 svn_fs_fs__read_changes(apr_array_header_t **changes,
                         svn_stream_t *stream,
-                        apr_pool_t *pool)
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool)
 {
   change_t *change;
-  apr_pool_t *iterpool = svn_pool_create(pool);
+  apr_pool_t *iterpool;
 
   /* pre-allocate enough room for most change lists
      (will be auto-expanded as necessary) */
-  *changes = apr_array_make(pool, 30, sizeof(change_t *));
+  *changes = apr_array_make(result_pool, 30, sizeof(change_t *));
 
-  SVN_ERR(read_change(&change, stream, pool, iterpool));
+  SVN_ERR(read_change(&change, stream, result_pool, scratch_pool));
+  iterpool = svn_pool_create(scratch_pool);
   while (change)
     {
       APR_ARRAY_PUSH(*changes, change_t*) = change;
-      SVN_ERR(read_change(&change, stream, pool, iterpool));
+      SVN_ERR(read_change(&change, stream, result_pool, iterpool));
       svn_pool_clear(iterpool);
     }
   svn_pool_destroy(iterpool);

Modified: subversion/trunk/subversion/libsvn_fs_fs/low_level.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/low_level.h?rev=1604902&r1=1604901&r2=1604902&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/low_level.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/low_level.h Mon Jun 23 18:29:40 2014
@@ -83,12 +83,13 @@ svn_fs_fs__unparse_footer(apr_off_t l2p_
                           apr_off_t p2l_offset,
                           apr_pool_t *pool);
 
-/* Read all the changes from STREAM and store them in *CHANGES.  Do all
-   allocations in POOL. */
+/* Read all the changes from STREAM and store them in *CHANGES,
+   allocated in RESULT_POOL. Do temporary allocations in SCRATCH_POOL. */
 svn_error_t *
 svn_fs_fs__read_changes(apr_array_header_t **changes,
                         svn_stream_t *stream,
-                        apr_pool_t *pool);
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool);
 
 typedef svn_error_t *(*svn_fs_fs__change_receiver_t)(
   void *baton,