Author: stefan2
Date: Sat Jan 17 23:13:09 2015
New Revision: 1652695

URL: http://svn.apache.org/r1652695
Log:
Switch svn_fs_x__get_file_delta_stream to using two pools.
Propagate that change up the caller stack.

* subversion/libsvn_fs_x/cached_data.h
  (svn_fs_x__get_file_delta_stream): Swith fully to the new paradigm.

* subversion/libsvn_fs_x/cached_data.c
  (get_storaged_delta_stream): POOL is pure RESULT_POOL.
  (svn_fs_x__get_file_delta_stream): Use both pools.

* subversion/libsvn_fs_x/dag.c
  (svn_fs_x__dag_get_file_delta_stream): Switch caller to using also 2 pools.

* subversion/libsvn_fs_x/dag.h
  (svn_fs_x__dag_get_file_delta_stream): Sync declaration with definition.

* subversion/libsvn_fs_x/tree.c
  (x_get_file_delta_stream): Update caller.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/cached_data.c
    subversion/trunk/subversion/libsvn_fs_x/cached_data.h
    subversion/trunk/subversion/libsvn_fs_x/dag.c
    subversion/trunk/subversion/libsvn_fs_x/dag.h
    subversion/trunk/subversion/libsvn_fs_x/tree.c

Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.c?rev=1652695&r1=1652694&r2=1652695&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Sat Jan 17 23:13:09 
2015
@@ -2317,20 +2317,20 @@ delta_read_md5_digest(void *baton)
 }
 
 /* Return a txdelta stream for on-disk representation REP_STATE
- * of TARGET.  Allocate the result in POOL.
+ * of TARGET.  Allocate the result in RESULT_POOL.
  */
 static svn_txdelta_stream_t *
 get_storaged_delta_stream(rep_state_t *rep_state,
                           svn_fs_x__noderev_t *target,
-                          apr_pool_t *pool)
+                          apr_pool_t *result_pool)
 {
   /* Create the delta read baton. */
-  delta_read_baton_t *drb = apr_pcalloc(pool, sizeof(*drb));
+  delta_read_baton_t *drb = apr_pcalloc(result_pool, sizeof(*drb));
   drb->rs = rep_state;
   memcpy(drb->md5_digest, target->data_rep->md5_digest,
          sizeof(drb->md5_digest));
   return svn_txdelta_stream_create(drb, delta_read_next_window,
-                                   delta_read_md5_digest, pool);
+                                   delta_read_md5_digest, result_pool);
 }
 
 svn_error_t *
@@ -2338,7 +2338,8 @@ svn_fs_x__get_file_delta_stream(svn_txde
                                 svn_fs_t *fs,
                                 svn_fs_x__noderev_t *source,
                                 svn_fs_x__noderev_t *target,
-                                apr_pool_t *pool)
+                                apr_pool_t *result_pool,
+                                apr_pool_t *scratch_pool)
 {
   svn_stream_t *source_stream, *target_stream;
   rep_state_t *rep_state;
@@ -2352,7 +2353,8 @@ svn_fs_x__get_file_delta_stream(svn_txde
     {
       /* Read target's base rep if any. */
       SVN_ERR(create_rep_state(&rep_state, &rep_header, NULL,
-                                target->data_rep, fs, pool, pool));
+                               target->data_rep, fs, result_pool,
+                               scratch_pool));
 
       /* Try a shortcut: if the target is stored as a delta against the source,
          then just use that delta. */
@@ -2366,7 +2368,8 @@ svn_fs_x__get_file_delta_stream(svn_txde
                  == svn_fs_x__get_revnum(source->data_rep->id.change_set)
               && rep_header->base_item_index == source->data_rep->id.number)
             {
-              *stream_p = get_storaged_delta_stream(rep_state, target, pool);
+              *stream_p = get_storaged_delta_stream(rep_state, target,
+                                                    result_pool);
               return SVN_NO_ERROR;
             }
         }
@@ -2377,7 +2380,8 @@ svn_fs_x__get_file_delta_stream(svn_txde
              format. */
           if (rep_header->type == svn_fs_x__rep_self_delta)
             {
-              *stream_p = get_storaged_delta_stream(rep_state, target, pool);
+              *stream_p = get_storaged_delta_stream(rep_state, target,
+                                                    result_pool);
               return SVN_NO_ERROR;
             }
         }
@@ -2393,16 +2397,17 @@ svn_fs_x__get_file_delta_stream(svn_txde
   /* Read both fulltexts and construct a delta. */
   if (source)
     SVN_ERR(svn_fs_x__get_contents(&source_stream, fs, source->data_rep,
-                                   TRUE, pool));
+                                   TRUE, result_pool));
   else
-    source_stream = svn_stream_empty(pool);
+    source_stream = svn_stream_empty(result_pool);
+
   SVN_ERR(svn_fs_x__get_contents(&target_stream, fs, target->data_rep,
-                                 TRUE, pool));
+                                 TRUE, result_pool));
 
   /* Because source and target stream will already verify their content,
    * there is no need to do this once more.  In particular if the stream
    * content is being fetched from cache. */
-  svn_txdelta2(stream_p, source_stream, target_stream, FALSE, pool);
+  svn_txdelta2(stream_p, source_stream, target_stream, FALSE, result_pool);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.h?rev=1652695&r1=1652694&r2=1652695&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.h Sat Jan 17 23:13:09 
2015
@@ -109,13 +109,16 @@ svn_fs_x__try_process_file_contents(svn_
 
 /* Set *STREAM_P to a delta stream turning the contents of the file SOURCE
    into the contents of the file TARGET, allocated in RESULT_POOL.
-   If SOURCE is NULL, an empty string will be used in its stead. */
+   If SOURCE is NULL, an empty string will be used in its stead.
+   Use SCRATCH_POOL for temporary allocations.
+ */
 svn_error_t *
 svn_fs_x__get_file_delta_stream(svn_txdelta_stream_t **stream_p,
                                 svn_fs_t *fs,
                                 svn_fs_x__noderev_t *source,
                                 svn_fs_x__noderev_t *target,
-                                apr_pool_t *result_pool);
+                                apr_pool_t *result_pool,
+                                apr_pool_t *scratch_pool);
 
 /* Set *ENTRIES to an apr_array_header_t of dirent structs that contain
    the directory entries of node-revision NODEREV in filesystem FS.  The

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.c?rev=1652695&r1=1652694&r2=1652695&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.c Sat Jan 17 23:13:09 2015
@@ -970,7 +970,8 @@ svn_error_t *
 svn_fs_x__dag_get_file_delta_stream(svn_txdelta_stream_t **stream_p,
                                     dag_node_t *source,
                                     dag_node_t *target,
-                                    apr_pool_t *pool)
+                                    apr_pool_t *result_pool,
+                                    apr_pool_t *scratch_pool)
 {
   svn_fs_x__noderev_t *src_noderev;
   svn_fs_x__noderev_t *tgt_noderev;
@@ -991,7 +992,8 @@ svn_fs_x__dag_get_file_delta_stream(svn_
 
   /* Get the delta stream. */
   return svn_fs_x__get_file_delta_stream(stream_p, target->fs,
-                                         src_noderev, tgt_noderev, pool);
+                                         src_noderev, tgt_noderev,
+                                         result_pool, scratch_pool);
 }
 
 

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.h?rev=1652695&r1=1652694&r2=1652695&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.h Sat Jan 17 23:13:09 2015
@@ -439,16 +439,17 @@ svn_fs_x__dag_try_process_file_contents(
 
 
 /* Set *STREAM_P to a delta stream that will turn the contents of SOURCE into
-   the contents of TARGET, allocated in POOL.  If SOURCE is null, the empty
-   string will be used.
+   the contents of TARGET, allocated in RESULT_POOL.  If SOURCE is null, the
+   empty string will be used is its stead.
 
-   Use POOL for all allocations.
+   Use SCRATCH_POOL for temporary allocations.
  */
 svn_error_t *
 svn_fs_x__dag_get_file_delta_stream(svn_txdelta_stream_t **stream_p,
                                     dag_node_t *source,
                                     dag_node_t *target,
-                                    apr_pool_t *pool);
+                                    apr_pool_t *result_pool,
+                                    apr_pool_t *scratch_pool);
 
 /* Return a generic writable stream in *CONTENTS with which to set the
    contents of FILE.  Allocate the stream in RESULT_POOL.

Modified: subversion/trunk/subversion/libsvn_fs_x/tree.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/tree.c?rev=1652695&r1=1652694&r2=1652695&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/tree.c Sat Jan 17 23:13:09 2015
@@ -3245,7 +3245,8 @@ x_get_file_delta_stream(svn_txdelta_stre
 
   /* Create a delta stream that turns the source into the target.  */
   SVN_ERR(svn_fs_x__dag_get_file_delta_stream(stream_p, source_node,
-                                              target_node, pool));
+                                              target_node, pool,
+                                              scratch_pool));
 
   svn_pool_destroy(scratch_pool);
   return SVN_NO_ERROR;


Reply via email to