subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1649866 - in /subversion/trunk/subversion/libsvn_fs_x: dag.c dag.h
Date Tue, 06 Jan 2015 16:29:13 GMT
Author: stefan2
Date: Tue Jan  6 16:29:13 2015
New Revision: 1649866

URL: http://svn.apache.org/r1649866
Log:
Continue migrating FSX to the two-pool paradigm.  Some single-pool functions
don't allocate temporary data, i.e. their pools can immediately be renamed
to RESULT_POOL.  Do this for dag.* .

* subversion/libsvn_fs_x/dag.h
  (svn_fs_x__dag_get_node,
   svn_fs_x__dag_dup,
   svn_fs_x__dag_copy_into_pool,
   svn_fs_x__dag_clone_root,
   svn_fs_x__dag_file_checksum): POOL is actually a RESULT_POOL.

* subversion/libsvn_fs_x/dag.c
  (copy_node_revision,
   svn_fs_x__dag_get_node,
   svn_fs_x__dag_txn_root,
   svn_fs_x__dag_clone_root,
   svn_fs_x__dag_file_checksum,
   svn_fs_x__dag_dup,
   svn_fs_x__dag_copy_into_pool): Same.

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

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.c?rev=1649866&r1=1649865&r2=1649866&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.c Tue Jan  6 16:29:13 2015
@@ -115,23 +115,24 @@ svn_fs_x__dag_set_fs(dag_node_t *node,
 }
 
 
-/* Dup NODEREV and all associated data into POOL.
+/* Dup NODEREV and all associated data into RESULT_POOL.
    Leaves the id and is_fresh_txn_root fields as zero bytes. */
 static svn_fs_x__noderev_t *
 copy_node_revision(svn_fs_x__noderev_t *noderev,
-                   apr_pool_t *pool)
+                   apr_pool_t *result_pool)
 {
-  svn_fs_x__noderev_t *nr = apr_pmemdup(pool, noderev, sizeof(*noderev));
+  svn_fs_x__noderev_t *nr = apr_pmemdup(result_pool, noderev,
+                                        sizeof(*noderev));
 
   if (noderev->copyfrom_path)
-    nr->copyfrom_path = apr_pstrdup(pool, noderev->copyfrom_path);
+    nr->copyfrom_path = apr_pstrdup(result_pool, noderev->copyfrom_path);
 
-  nr->copyroot_path = apr_pstrdup(pool, noderev->copyroot_path);
-  nr->data_rep = svn_fs_x__rep_copy(noderev->data_rep, pool);
-  nr->prop_rep = svn_fs_x__rep_copy(noderev->prop_rep, pool);
+  nr->copyroot_path = apr_pstrdup(result_pool, noderev->copyroot_path);
+  nr->data_rep = svn_fs_x__rep_copy(noderev->data_rep, result_pool);
+  nr->prop_rep = svn_fs_x__rep_copy(noderev->prop_rep, result_pool);
 
   if (noderev->created_path)
-    nr->created_path = apr_pstrdup(pool, noderev->created_path);
+    nr->created_path = apr_pstrdup(result_pool, noderev->created_path);
 
   return nr;
 }
@@ -238,23 +239,23 @@ svn_error_t *
 svn_fs_x__dag_get_node(dag_node_t **node,
                        svn_fs_t *fs,
                        const svn_fs_x__id_t *id,
-                       apr_pool_t *pool)
+                       apr_pool_t *result_pool)
 {
   dag_node_t *new_node;
   svn_fs_x__noderev_t *noderev;
 
   /* Construct the node. */
-  new_node = apr_pcalloc(pool, sizeof(*new_node));
+  new_node = apr_pcalloc(result_pool, sizeof(*new_node));
   new_node->fs = fs;
   new_node->id = *id;
 
   /* Grab the contents so we can inspect the node's kind and created path. */
-  new_node->node_pool = pool;
+  new_node->node_pool = result_pool;
   SVN_ERR(get_node_revision(&noderev, new_node));
 
   /* Initialize the KIND and CREATED_PATH attributes */
   new_node->kind = noderev->kind;
-  new_node->created_path = apr_pstrdup(pool, noderev->created_path);
+  new_node->created_path = apr_pstrdup(result_pool, noderev->created_path);
 
   if (noderev->is_fresh_txn_root)
     new_node->fresh_root_predecessor_id = noderev->predecessor_id;
@@ -686,12 +687,12 @@ svn_error_t *
 svn_fs_x__dag_txn_root(dag_node_t **node_p,
                        svn_fs_t *fs,
                        svn_fs_x__txn_id_t txn_id,
-                       apr_pool_t *pool)
+                       apr_pool_t *result_pool)
 {
   svn_fs_x__id_t root_id;
 
   svn_fs_x__init_txn_root(&root_id, txn_id);
-  return svn_fs_x__dag_get_node(node_p, fs, &root_id, pool);
+  return svn_fs_x__dag_get_node(node_p, fs, &root_id, result_pool);
 }
 
 
@@ -798,13 +799,13 @@ svn_error_t *
 svn_fs_x__dag_clone_root(dag_node_t **root_p,
                          svn_fs_t *fs,
                          svn_fs_x__txn_id_t txn_id,
-                         apr_pool_t *pool)
+                         apr_pool_t *result_pool)
 {
   svn_fs_x__id_t root_id;
   svn_fs_x__init_txn_root(&root_id, txn_id);
 
   /* One way or another, root_id now identifies a cloned root node. */
-  return svn_fs_x__dag_get_node(root_p, fs, &root_id, pool);
+  return svn_fs_x__dag_get_node(root_p, fs, &root_id, result_pool);
 }
 
 
@@ -1031,7 +1032,7 @@ svn_error_t *
 svn_fs_x__dag_file_checksum(svn_checksum_t **checksum,
                             dag_node_t *file,
                             svn_checksum_kind_t kind,
-                            apr_pool_t *pool)
+                            apr_pool_t *result_pool)
 {
   svn_fs_x__noderev_t *noderev;
 
@@ -1042,7 +1043,7 @@ svn_fs_x__dag_file_checksum(svn_checksum
 
   SVN_ERR(get_node_revision(&noderev, file));
 
-  return svn_fs_x__file_checksum(checksum, noderev, kind, pool);
+  return svn_fs_x__file_checksum(checksum, noderev, kind, result_pool);
 }
 
 
@@ -1102,35 +1103,36 @@ svn_fs_x__dag_finalize_edits(dag_node_t
 
 dag_node_t *
 svn_fs_x__dag_dup(const dag_node_t *node,
-                  apr_pool_t *pool)
+                  apr_pool_t *result_pool)
 {
   /* Allocate our new node. */
-  dag_node_t *new_node = apr_pmemdup(pool, node, sizeof(*new_node));
+  dag_node_t *new_node = apr_pmemdup(result_pool, node, sizeof(*new_node));
 
   /* Only copy cached svn_fs_x__noderev_t for immutable nodes. */
   if (node->node_revision && !svn_fs_x__dag_check_mutable(node))
     {
-      new_node->node_revision = copy_node_revision(node->node_revision, pool);
+      new_node->node_revision = copy_node_revision(node->node_revision,
+                                                   result_pool);
       new_node->created_path = new_node->node_revision->created_path;
     }
   else
     {
       new_node->node_revision = NULL;
-      new_node->created_path = apr_pstrdup(pool, node->created_path);
+      new_node->created_path = apr_pstrdup(result_pool, node->created_path);
     }
 
-  new_node->node_pool = pool;
+  new_node->node_pool = result_pool;
 
   return new_node;
 }
 
 dag_node_t *
 svn_fs_x__dag_copy_into_pool(dag_node_t *node,
-                             apr_pool_t *pool)
+                             apr_pool_t *result_pool)
 {
-  return (node->node_pool == pool
+  return (node->node_pool == result_pool
             ? node
-            : svn_fs_x__dag_dup(node, pool));
+            : svn_fs_x__dag_dup(node, result_pool));
 }
 
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.h?rev=1649866&r1=1649865&r2=1649866&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.h Tue Jan  6 16:29:13 2015
@@ -65,27 +65,27 @@ extern "C" {
 typedef struct dag_node_t dag_node_t;
 
 /* Fill *NODE with a dag_node_t representing node revision ID in FS,
-   allocating in POOL.  */
+   allocating in RESULT_POOL.  */
 svn_error_t *
 svn_fs_x__dag_get_node(dag_node_t **node,
                        svn_fs_t *fs,
                        const svn_fs_x__id_t *id,
-                       apr_pool_t *pool);
+                       apr_pool_t *result_pool);
 
 
 /* Return a new dag_node_t object referring to the same node as NODE,
-   allocated in POOL.  If you're trying to build a structure in a
+   allocated in RESULT_POOL.  If you're trying to build a structure in a
    pool that wants to refer to dag nodes that may have been allocated
    elsewhere, you can call this function and avoid inter-pool pointers. */
 dag_node_t *
 svn_fs_x__dag_dup(const dag_node_t *node,
-                  apr_pool_t *pool);
+                  apr_pool_t *result_pool);
 
 /* If NODE has been allocated in POOL, return NODE.  Otherwise, return
-   a copy created in POOL with svn_fs_fs__dag_dup. */
+   a copy created in RESULT_POOL with svn_fs_fs__dag_dup. */
 dag_node_t *
 svn_fs_x__dag_copy_into_pool(dag_node_t *node,
-                             apr_pool_t *pool);
+                             apr_pool_t *result_pool);
 
 /* Serialize a DAG node, except don't try to preserve the 'fs' member.
    Implements svn_cache__serialize_func_t */
@@ -286,12 +286,12 @@ svn_fs_x__dag_txn_base_root(dag_node_t *
 /* Clone the root directory of TXN_ID in FS, and update the
    `transactions' table entry to point to it, unless this has been
    done already.  In either case, set *ROOT_P to a reference to the
-   root directory clone.  Allocate *ROOT_P in POOL.  */
+   root directory clone.  Allocate *ROOT_P in RESULT_POOL.  */
 svn_error_t *
 svn_fs_x__dag_clone_root(dag_node_t **root_p,
                          svn_fs_t *fs,
                          svn_fs_x__txn_id_t txn_id,
-                         apr_pool_t *pool);
+                         apr_pool_t *result_pool);
 
 
 
@@ -514,18 +514,16 @@ svn_fs_x__dag_file_length(svn_filesize_t
                           apr_pool_t *pool);
 
 /* Put the recorded checksum of type KIND for FILE into CHECKSUM, allocating
-   from POOL.
+   from RESULT_POOL.
 
    If no stored checksum is available, do not calculate the checksum,
    just put NULL into CHECKSUM.
-
-   Use POOL for all allocations.
  */
 svn_error_t *
 svn_fs_x__dag_file_checksum(svn_checksum_t **checksum,
                             dag_node_t *file,
                             svn_checksum_kind_t kind,
-                            apr_pool_t *pool);
+                            apr_pool_t *result_pool);
 
 /* Create a new mutable file named NAME in PARENT.  Set *CHILD_P to a
    reference to the new node, allocated in POOL.  The new file's



Mime
View raw message