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 2011/05/21 14:05:44 UTC

svn commit: r1125673 - /subversion/trunk/subversion/libsvn_wc/wc_db.c

Author: stsp
Date: Sat May 21 12:05:44 2011
New Revision: 1125673

URL: http://svn.apache.org/viewvc?rev=1125673&view=rev
Log:
Small optimisation in access baton cache flushing code.

* subversion/libsvn_wc/wc_db.c
  (is_immediate_child_path): Add new parameter PARENT_COMPONENT_COUNT and
   use that instead of computing the path component count of PARENT_ABSPATH.
  (flush_entries): Compute the path component count of LOCAL_ABSPATH before
   looping over hash table entries. The value is constant for all iterations.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1125673&r1=1125672&r2=1125673&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sat May 21 12:05:44 2011
@@ -1199,13 +1199,16 @@ gather_repo_children(const apr_array_hea
 }
 
 
-/* Return TRUE if CHILD_ABSPATH is an immediate child of PARENT_ABSPATH.
+/* Return TRUE if CHILD_ABSPATH is an immediate child of PARENT_ABSPATH
+ * which has PARENT_COMPONENT_COUNT path components.
  * Else, return FALSE. */
 static svn_boolean_t
-is_immediate_child_path(const char *parent_abspath, const char *child_abspath)
+is_immediate_child_path(const char *parent_abspath,
+                        apr_size_t parent_component_count,
+                        const char *child_abspath)
 {
   return (svn_dirent_is_ancestor(parent_abspath, child_abspath) &&
-            svn_path_component_count(parent_abspath) ==
+            parent_component_count ==
             svn_path_component_count(child_abspath) + 1);
 }
 
@@ -1247,6 +1250,7 @@ flush_entries(svn_wc__db_wcroot_t *wcroo
   if (depth > svn_depth_empty)
     {
       apr_hash_index_t *hi;
+      apr_size_t component_count = svn_path_component_count(local_abspath);
 
       /* Flush access batons of children within the specified depth. */
       for (hi = apr_hash_first(scratch_pool, wcroot->access_cache);
@@ -1256,7 +1260,8 @@ flush_entries(svn_wc__db_wcroot_t *wcroo
           const char *item_abspath = svn__apr_hash_index_key(hi);
 
           if ((depth == svn_depth_files || depth == svn_depth_immediates) &&
-              is_immediate_child_path(local_abspath, item_abspath))
+              is_immediate_child_path(local_abspath, component_count,
+                                      item_abspath))
             {
               remove_from_access_cache(wcroot->access_cache, item_abspath);
             }