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 2015/01/16 20:20:55 UTC

svn commit: r1652496 - in /subversion/trunk/subversion/libsvn_fs_x: cached_data.c transaction.c util.c util.h

Author: stefan2
Date: Fri Jan 16 19:20:55 2015
New Revision: 1652496

URL: http://svn.apache.org/r1652496
Log:
Deal with the last set of path constructors in FSX.  The temporary strings
they create cannot be eliminated reasonably, therefore swtich the functions
to using two pools and update the callers.

* subversion/libsvn_fs_x/util.h
  (svn_fs_x__path_txn_node_rev,
   svn_fs_x__path_txn_node_props,
   svn_fs_x__path_txn_node_children): Switch signature to using two pools

* subversion/libsvn_fs_x/util.c
  (construct_txn_node_path): New path construction utility.
  (svn_fs_x__path_txn_node_rev,
   svn_fs_x__path_txn_node_props,
   svn_fs_x__path_txn_node_children): Simplify by calling the new utility.
                                      Now use two pool parameters.

* subversion/libsvn_fs_x/cached_data.c
  (get_node_revision_body,
   get_dir_contents,
   svn_fs_x__get_proplist): Update callers.

* subversion/libsvn_fs_x/transaction.c
  (svn_fs_x__put_node_revision,
   svn_fs_x__set_entry,
   svn_fs_x__set_proplist,
   svn_fs_x__delete_node_revision): Same.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/cached_data.c
    subversion/trunk/subversion/libsvn_fs_x/transaction.c
    subversion/trunk/subversion/libsvn_fs_x/util.c
    subversion/trunk/subversion/libsvn_fs_x/util.h

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=1652496&r1=1652495&r2=1652496&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Fri Jan 16 19:20:55 2015
@@ -299,6 +299,7 @@ get_node_revision_body(svn_fs_x__noderev
          different from that of rev / pack files. */
       err = svn_io_file_open(&file,
                              svn_fs_x__path_txn_node_rev(fs, id,
+                                                         scratch_pool,
                                                          scratch_pool),
                              APR_READ | APR_BUFFERED, APR_OS_DEFAULT,
                              scratch_pool);
@@ -2579,7 +2580,8 @@ get_dir_contents(apr_array_header_t **en
       && ! svn_fs_x__is_revision(noderev->data_rep->id.change_set))
     {
       const char *filename
-        = svn_fs_x__path_txn_node_children(fs, id, scratch_pool);
+        = svn_fs_x__path_txn_node_children(fs, id, scratch_pool,
+                                           scratch_pool);
 
       /* The representation is mutable.  Read the old directory
          contents from the mutable children file, followed by the
@@ -2755,7 +2757,7 @@ svn_fs_x__get_proplist(apr_hash_t **prop
       && !svn_fs_x__is_revision(noderev->prop_rep->id.change_set))
     {
       const char *filename
-        = svn_fs_x__path_txn_node_props(fs, noderev_id, pool);
+        = svn_fs_x__path_txn_node_props(fs, noderev_id, pool, pool);
       proplist = apr_hash_make(pool);
 
       SVN_ERR(svn_stream_open_readonly(&stream, filename, pool, pool));

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1652496&r1=1652495&r2=1652496&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Fri Jan 16 19:20:55 2015
@@ -773,7 +773,8 @@ svn_fs_x__put_node_revision(svn_fs_t *fs
                              svn_fs_x__id_unparse(id, scratch_pool)->data);
 
   SVN_ERR(svn_io_file_open(&noderev_file,
-                           svn_fs_x__path_txn_node_rev(fs, id, scratch_pool),
+                           svn_fs_x__path_txn_node_rev(fs, id, scratch_pool,
+                                                       scratch_pool),
                            APR_WRITE | APR_CREATE | APR_TRUNCATE
                            | APR_BUFFERED, APR_OS_DEFAULT, scratch_pool));
 
@@ -1694,7 +1695,7 @@ svn_fs_x__set_entry(svn_fs_t *fs,
   svn_fs_x__representation_t *rep = parent_noderev->data_rep;
   const char *filename
     = svn_fs_x__path_txn_node_children(fs, &parent_noderev->noderev_id,
-                                       scratch_pool);
+                                       scratch_pool, scratch_pool);
   apr_file_t *file;
   svn_stream_t *out;
   svn_fs_x__data_t *ffd = fs->fsap_data;
@@ -2461,7 +2462,8 @@ svn_fs_x__set_proplist(svn_fs_t *fs,
                        apr_pool_t *scratch_pool)
 {
   const svn_fs_x__id_t *id = &noderev->noderev_id;
-  const char *filename = svn_fs_x__path_txn_node_props(fs, id, scratch_pool);
+  const char *filename = svn_fs_x__path_txn_node_props(fs, id, scratch_pool,
+                                                       scratch_pool);
   apr_file_t *file;
   svn_stream_t *out;
 
@@ -3623,6 +3625,7 @@ svn_fs_x__delete_node_revision(svn_fs_t
   if (noderev->prop_rep
       && svn_fs_x__is_txn(noderev->prop_rep->id.change_set))
     SVN_ERR(svn_io_remove_file2(svn_fs_x__path_txn_node_props(fs, id,
+                                                              scratch_pool,
                                                               scratch_pool),
                                 FALSE, scratch_pool));
 
@@ -3635,15 +3638,17 @@ svn_fs_x__delete_node_revision(svn_fs_t
       const svn_fs_x__id_t *key = id;
 
       SVN_ERR(svn_io_remove_file2(
-                  svn_fs_x__path_txn_node_children(fs, id, scratch_pool),
+                  svn_fs_x__path_txn_node_children(fs, id, scratch_pool,
+                                                   scratch_pool),
                   FALSE, scratch_pool));
 
       /* remove the corresponding entry from the cache, if such exists */
       SVN_ERR(svn_cache__set(ffd->dir_cache, key, NULL, scratch_pool));
     }
 
-  return svn_io_remove_file2(svn_fs_x__path_txn_node_rev(fs,
-                                                         id, scratch_pool),
+  return svn_io_remove_file2(svn_fs_x__path_txn_node_rev(fs, id,
+                                                         scratch_pool,
+                                                         scratch_pool),
                              FALSE, scratch_pool);
 }
 

Modified: subversion/trunk/subversion/libsvn_fs_x/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.c?rev=1652496&r1=1652495&r2=1652496&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.c Fri Jan 16 19:20:55 2015
@@ -434,35 +434,54 @@ svn_fs_x__path_txn_proto_rev_lock(svn_fs
   return construct_proto_rev_path(fs, txn_id, PATH_EXT_REV_LOCK, result_pool);
 }
 
+/* Return the full path of the noderev-related file with the extension SUFFIX
+ * for noderev *ID in transaction TXN_ID in FS.
+ *
+ * Allocate the result in RESULT_POOL and temporaries in SCRATCH_POOL.
+ */
+static const char *
+construct_txn_node_path(svn_fs_t *fs,
+                        const svn_fs_x__id_t *id,
+                        const char *suffix,
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool)
+{
+  const char *filename = svn_fs_x__id_unparse(id, result_pool)->data;
+  apr_int64_t txn_id = svn_fs_x__get_txn_id(id->change_set);
+
+  return svn_dirent_join(svn_fs_x__path_txn_dir(fs, txn_id, scratch_pool),
+                         apr_psprintf(scratch_pool, PATH_PREFIX_NODE "%s%s",
+                                      filename, suffix),
+                         result_pool);
+}
+
 const char *
 svn_fs_x__path_txn_node_rev(svn_fs_t *fs,
                             const svn_fs_x__id_t *id,
-                            apr_pool_t *pool)
+                            apr_pool_t *result_pool,
+                            apr_pool_t *scratch_pool)
 {
-  const char *filename = svn_fs_x__id_unparse(id, pool)->data;
-  apr_int64_t txn_id = svn_fs_x__get_txn_id(id->change_set);
-
-  return svn_dirent_join(svn_fs_x__path_txn_dir(fs, txn_id, pool),
-                         apr_psprintf(pool, PATH_PREFIX_NODE "%s", filename),
-                         pool);
+  return construct_txn_node_path(fs, id, "", result_pool, scratch_pool);
 }
 
 const char *
 svn_fs_x__path_txn_node_props(svn_fs_t *fs,
                               const svn_fs_x__id_t *id,
-                              apr_pool_t *pool)
+                              apr_pool_t *result_pool,
+                              apr_pool_t *scratch_pool)
 {
-  return apr_pstrcat(pool, svn_fs_x__path_txn_node_rev(fs, id, pool),
-                     PATH_EXT_PROPS, SVN_VA_NULL);
+  return construct_txn_node_path(fs, id, PATH_EXT_PROPS, result_pool,
+                                 scratch_pool);
 }
 
 const char *
 svn_fs_x__path_txn_node_children(svn_fs_t *fs,
                                  const svn_fs_x__id_t *id,
-                                 apr_pool_t *pool)
+                                 apr_pool_t *result_pool,
+                                 apr_pool_t *scratch_pool)
 {
-  return apr_pstrcat(pool, svn_fs_x__path_txn_node_rev(fs, id, pool),
-                     PATH_EXT_CHILDREN, SVN_VA_NULL);
+  return construct_txn_node_path(fs, id, PATH_EXT_CHILDREN, result_pool,
+                                 scratch_pool);
 }
 
 

Modified: subversion/trunk/subversion/libsvn_fs_x/util.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.h?rev=1652496&r1=1652495&r2=1652496&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.h Fri Jan 16 19:20:55 2015
@@ -338,29 +338,34 @@ svn_fs_x__path_txn_proto_rev_lock(svn_fs
                                   apr_pool_t *result_pool);
 
 /* Return the path of the file containing the in-transaction node revision
- * identified by ID in FS.  The result will be allocated in POOL.
+ * identified by ID in FS.
+ * The result will be allocated in RESULT_POOL, temporaries in SCRATCH_POOL.
  */
 const char *
 svn_fs_x__path_txn_node_rev(svn_fs_t *fs,
                             const svn_fs_x__id_t *id,
-                            apr_pool_t *pool);
+                            apr_pool_t *result_pool,
+                            apr_pool_t *scratch_pool);
 
 /* Return the path of the file containing the in-transaction properties of
- * the node identified by ID in FS.  The result will be allocated in POOL.
+ * the node identified by ID in FS.
+ * The result will be allocated in RESULT_POOL, temporaries in SCRATCH_POOL.
  */
 const char *
 svn_fs_x__path_txn_node_props(svn_fs_t *fs,
                               const svn_fs_x__id_t *id,
-                              apr_pool_t *pool);
+                              apr_pool_t *result_pool,
+                              apr_pool_t *scratch_pool);
 
 /* Return the path of the file containing the directory entries of the
  * in-transaction directory node identified by ID in FS.
- * The result will be allocated in POOL.
+ * The result will be allocated in RESULT_POOL, temporaries in SCRATCH_POOL.
  */
 const char *
 svn_fs_x__path_txn_node_children(svn_fs_t *fs,
                                  const svn_fs_x__id_t *id,
-                                 apr_pool_t *pool);
+                                 apr_pool_t *result_pool,
+                                 apr_pool_t *scratch_pool);
 
 /* Check that BUF, a nul-terminated buffer of text from file PATH,
    contains only digits at OFFSET and beyond, raising an error if not.