subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1658722 - in /subversion/branches/fsx-1.10/subversion/libsvn_fs_x: dag_cache.c dag_cache.h tree.c
Date Tue, 10 Feb 2015 14:35:23 GMT
Author: stefan2
Date: Tue Feb 10 14:35:22 2015
New Revision: 1658722

URL: http://svn.apache.org/r1658722
Log:
On the fsx-1.10 branch:  Simplify function signatures in dag_cache.c .
In a few cases, we don't need pools and svn_error_t return values.

* subversion/libsvn_fs_x/dag_cache.c
  (dag_node_cache_get): No pool needed and return the result directly.
  (svn_fs_x__set_dag_node,
   svn_fs_x__invalidate_dag_cache): No pool nor error return needed.
  (try_match_last_node,
   svn_fs_x__get_dag_path,
   svn_fs_x__make_path_mutable,
   svn_fs_x__get_dag_node): Update callers.

* subversion/libsvn_fs_x/dag_cache.h
  (svn_fs_x__invalidate_dag_cache,
   svn_fs_x__set_dag_node): Sync header declarations with the definition.

* subversion/libsvn_fs_x/tree.c
  (x_make_dir,
   x_delete_node,
   copy_helper,
   x_make_file): Upate callers.

Modified:
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h
    subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c?rev=1658722&r1=1658721&r2=1658722&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.c Tue Feb 10 14:35:22 2015
@@ -310,35 +310,27 @@ cache_lookup_last_path(svn_fs_x__dag_cac
   return NULL;
 }
 
-/* Return NODE for PATH from ROOT's node cache, or NULL if the node
-   isn't cached; read it from the FS. *NODE remains valid until either
-   POOL or the FS gets cleared or destroyed (whichever comes first).
+/* Return the cached DAG node for PATH from ROOT's node cache, or NULL if
+   the node isn't cached.
  */
-static svn_error_t *
-dag_node_cache_get(dag_node_t **node_p,
-                   svn_fs_root_t *root,
-                   const char *path,
-                   apr_pool_t *pool)
+static dag_node_t *
+dag_node_cache_get(svn_fs_root_t *root,
+                   const char *path)
 {
   svn_fs_x__data_t *ffd = root->fs->fsap_data;
   cache_entry_t *bucket;
 
-  SVN_ERR_ASSERT(*path == '/');
-
   auto_clear_dag_cache(ffd->dag_node_cache);
   bucket = cache_lookup(ffd->dag_node_cache, root_change_set(root), path);
-  *node_p = bucket->node;
-
-  return SVN_NO_ERROR;
+  return bucket->node;
 }
 
 
 /* Add the NODE for PATH to ROOT's node cache. */
-svn_error_t *
+void
 svn_fs_x__set_dag_node(svn_fs_root_t *root,
                        const char *path,
-                       dag_node_t *node,
-                       apr_pool_t *scratch_pool)
+                       dag_node_t *node)
 {
   svn_fs_x__data_t *ffd = root->fs->fsap_data;
   cache_entry_t *bucket;
@@ -347,14 +339,11 @@ svn_fs_x__set_dag_node(svn_fs_root_t *ro
   auto_clear_dag_cache(cache);
   bucket = cache_lookup(cache, root_change_set(root), path);
   bucket->node = svn_fs_x__dag_copy_into_pool(node, cache->pool);
-
-  return SVN_NO_ERROR;
 }
 
-svn_error_t *
+void
 svn_fs_x__invalidate_dag_cache(svn_fs_root_t *root,
-                               const char *path,
-                               apr_pool_t *scratch_pool)
+                               const char *path)
 {
   svn_fs_x__data_t *ffd = root->fs->fsap_data;
   svn_fs_x__dag_cache_t *cache = ffd->dag_node_cache;
@@ -369,8 +358,6 @@ svn_fs_x__invalidate_dag_cache(svn_fs_ro
           && svn_relpath_skip_ancestor(path + 1, bucket->path + 1))
         bucket->node = NULL;
     }
-
-  return SVN_NO_ERROR;
 }
 
 
@@ -584,7 +571,7 @@ try_match_last_node(dag_node_t **node_p,
       if (revision == root->rev && strcmp(created_path, path) == 0)
         {
           /* Cache it under its full path@rev access path. */
-          SVN_ERR(svn_fs_x__set_dag_node(root, path, node, scratch_pool));
+          svn_fs_x__set_dag_node(root, path, node);
 
           *node_p = node;
           return SVN_NO_ERROR;
@@ -661,7 +648,7 @@ svn_fs_x__get_dag_path(svn_fs_x__dag_pat
       directory = svn_dirent_dirname(path, pool);
       if (directory[1] != 0) /* root nodes are covered anyway */
         {
-          SVN_ERR(dag_node_cache_get(&here, root, directory, pool));
+          here = dag_node_cache_get(root, directory);
 
           /* Did the shortcut work? */
           if (here)
@@ -728,8 +715,7 @@ svn_fs_x__get_dag_path(svn_fs_x__dag_pat
              element if we already know the lookup to fail for the
              complete path. */
           if (next || !(flags & svn_fs_x__dag_path_uncached))
-            SVN_ERR(dag_node_cache_get(&cached_node, root, path_so_far->data,
-                                       pool));
+            cached_node = dag_node_cache_get(root, path_so_far->data);
           if (cached_node)
             child = cached_node;
           else
@@ -782,8 +768,7 @@ svn_fs_x__get_dag_path(svn_fs_x__dag_pat
 
           /* Cache the node we found (if it wasn't already cached). */
           if (! cached_node)
-            SVN_ERR(svn_fs_x__set_dag_node(root, path_so_far->data, child,
-                                           iterpool));
+            svn_fs_x__set_dag_node(root, path_so_far->data, child);
         }
 
       /* Are we finished traversing the path?  */
@@ -889,9 +874,8 @@ svn_fs_x__make_path_mutable(svn_fs_root_
                                         subpool));
 
       /* Update the path cache. */
-      SVN_ERR(svn_fs_x__set_dag_node(root,
-                                     parent_path_path(parent_path, subpool),
-                                     clone, subpool));
+      svn_fs_x__set_dag_node(root, parent_path_path(parent_path, subpool),
+                             clone);
       svn_pool_destroy(subpool);
     }
   else
@@ -920,7 +904,7 @@ svn_fs_x__get_dag_node(dag_node_t **dag_
   /* First we look for the DAG in our cache
      (if the path may be canonical). */
   if (*path == '/')
-    SVN_ERR(dag_node_cache_get(&node, root, path, pool));
+    node = dag_node_cache_get(root, path);
 
   if (! node)
     {
@@ -930,7 +914,7 @@ svn_fs_x__get_dag_node(dag_node_t **dag_
        * performance benefit over previously checking path for being
        * canonical. */
       path = svn_fs__canonicalize_abspath(path, pool);
-      SVN_ERR(dag_node_cache_get(&node, root, path, pool));
+      node = dag_node_cache_get(root, path);
 
       if (! node)
         {

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h?rev=1658722&r1=1658721&r2=1658722&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/dag_cache.h Tue Feb 10 14:35:22 2015
@@ -33,12 +33,10 @@ extern "C" {
 svn_fs_x__dag_cache_t*
 svn_fs_x__create_dag_cache(apr_pool_t *result_pool);
 
-/* Invalidate cache entries for PATH and any of its children.  This
-   should *only* be called on a transaction root! */
-svn_error_t *
+/* Invalidate cache entries for PATH within ROOT and any of its children. */
+void
 svn_fs_x__invalidate_dag_cache(svn_fs_root_t *root,
-                               const char *path,
-                               apr_pool_t *scratch_pool);
+                               const char *path);
 
 /* Flag type used in svn_fs_x__dag_path_t to determine where the
    respective node got its copy ID from. */
@@ -161,11 +159,10 @@ svn_fs_x__get_dag_node(dag_node_t **dag_
                        apr_pool_t *pool);
 
 /* Add the NODE for PATH to ROOT's node cache. */
-svn_error_t *
+void
 svn_fs_x__set_dag_node(svn_fs_root_t *root,
                        const char *path,
-                       dag_node_t *node,
-                       apr_pool_t *scratch_pool);
+                       dag_node_t *node);
 
 #ifdef __cplusplus
 }

Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c?rev=1658722&r1=1658721&r2=1658722&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/tree.c Tue Feb 10 14:35:22 2015
@@ -1449,8 +1449,7 @@ x_make_dir(svn_fs_root_t *root,
                                  subpool, subpool));
 
   /* Add this directory to the path cache. */
-  SVN_ERR(svn_fs_x__set_dag_node(root, parent_path_path(dag_path, subpool),
-                                 sub_dir, subpool));
+  svn_fs_x__set_dag_node(root, parent_path_path(dag_path, subpool), sub_dir);
 
   /* Make a record of this modification in the changes table. */
   SVN_ERR(add_change(root->fs, txn_id, path, svn_fs_x__dag_get_id(sub_dir),
@@ -1504,9 +1503,7 @@ x_delete_node(svn_fs_root_t *root,
                                txn_id, subpool));
 
   /* Remove this node and any children from the path cache. */
-  SVN_ERR(svn_fs_x__invalidate_dag_cache(root,
-                                         parent_path_path(dag_path, subpool),
-                                         subpool));
+  svn_fs_x__invalidate_dag_cache(root, parent_path_path(dag_path, subpool));
 
   /* Update mergeinfo counts for parents */
   if (mergeinfo_count > 0)
@@ -1641,10 +1638,9 @@ copy_helper(svn_fs_root_t *from_root,
                                  txn_id, scratch_pool));
 
       if (kind != svn_fs_path_change_add)
-        SVN_ERR(svn_fs_x__invalidate_dag_cache(to_root,
-                                               parent_path_path(to_dag_path,
-                                                                scratch_pool),
-                                               scratch_pool));
+        svn_fs_x__invalidate_dag_cache(to_root,
+                                       parent_path_path(to_dag_path,
+                                                        scratch_pool));
 
       if (mergeinfo_start != mergeinfo_end)
         SVN_ERR(increment_mergeinfo_up_tree(to_dag_path->parent,
@@ -1794,8 +1790,7 @@ x_make_file(svn_fs_root_t *root,
                                   subpool, subpool));
 
   /* Add this file to the path cache. */
-  SVN_ERR(svn_fs_x__set_dag_node(root, parent_path_path(dag_path, subpool),
-                                 child, subpool));
+  svn_fs_x__set_dag_node(root, parent_path_path(dag_path, subpool), child);
 
   /* Make a record of this modification in the changes table. */
   SVN_ERR(add_change(root->fs, txn_id, path, svn_fs_x__dag_get_id(child),



Mime
View raw message