subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1141869 - /subversion/trunk/subversion/libsvn_wc/wc_db.c
Date Fri, 01 Jul 2011 08:37:07 GMT
Author: rhuijben
Date: Fri Jul  1 08:37:07 2011
New Revision: 1141869

URL: http://svn.apache.org/viewvc?rev=1141869&view=rev
Log:
Don't use path component count based functions when not absolutely necessary.

* subversion/libsvn_wc/wc_db.c
  (is_immediate_child_path): Use the skip ancestor function to find the
    relative path and then check if the local relpath has just one component.
    This allows removing the additional scan via component counts.

  (flush_entries): Update caller.

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=1141869&r1=1141868&r2=1141869&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jul  1 08:37:07 2011
@@ -1212,17 +1212,17 @@ gather_repo_children(const apr_array_hea
 }
 
 
-/* Return TRUE if CHILD_ABSPATH is an immediate child of PARENT_ABSPATH
- * which has PARENT_COMPONENT_COUNT path components.
+/* Return TRUE if CHILD_ABSPATH is an immediate child of PARENT_ABSPATH.
  * Else, return FALSE. */
 static svn_boolean_t
-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) &&
-            parent_component_count ==
-            svn_path_component_count(child_abspath) - 1);
+is_immediate_child_path(const char *parent_abspath, const char *child_abspath)
+{
+  const char *local_relpath = svn_dirent_skip_ancestor(parent_abspath,
+                                                       child_abspath);
+
+  /* To be an immediate child local_relpath should have one (not empty)
+     component */
+  return local_relpath && *local_relpath && !strchr(local_relpath, '/');
 }
 
 
@@ -1263,7 +1263,6 @@ 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);
@@ -1273,8 +1272,7 @@ 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, component_count,
-                                      item_abspath))
+              is_immediate_child_path(local_abspath, item_abspath))
             {
               remove_from_access_cache(wcroot->access_cache, item_abspath);
             }



Mime
View raw message