subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject svn commit: r1646021 - /subversion/trunk/subversion/libsvn_fs_fs/transaction.c
Date Tue, 16 Dec 2014 17:37:57 GMT
Author: ivan
Date: Tue Dec 16 17:37:57 2014
New Revision: 1646021

URL: http://svn.apache.org/r1646021
Log:
Simplify FSFS locking code a bit.

* subversion/libsvn_fs_fs/transaction.c
  (verify_locks): Use svn_sort__hash() for sorting hash of changed paths.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/transaction.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/transaction.c?rev=1646021&r1=1646020&r2=1646021&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/transaction.c Tue Dec 16 17:37:57 2014
@@ -3192,33 +3192,32 @@ verify_locks(svn_fs_t *fs,
              apr_pool_t *pool)
 {
   apr_pool_t *subpool = svn_pool_create(pool);
-  apr_hash_index_t *hi;
   apr_array_header_t *changed_paths_sorted;
   svn_stringbuf_t *last_recursed = NULL;
   int i;
 
   /* Make an array of the changed paths, and sort them depth-first-ily.  */
-  changed_paths_sorted = apr_array_make(pool,
-                                        apr_hash_count(changed_paths) + 1,
-                                        sizeof(const char *));
-  for (hi = apr_hash_first(pool, changed_paths); hi; hi = apr_hash_next(hi))
-    {
-      APR_ARRAY_PUSH(changed_paths_sorted, const char *) =
-        apr_hash_this_key(hi);
-    }
-  svn_sort__array(changed_paths_sorted, svn_sort_compare_paths);
+  changed_paths_sorted = svn_sort__hash(changed_paths,
+                                        svn_sort_compare_items_as_paths,
+                                        pool);
 
   /* Now, traverse the array of changed paths, verify locks.  Note
      that if we need to do a recursive verification a path, we'll skip
      over children of that path when we get to them. */
   for (i = 0; i < changed_paths_sorted->nelts; i++)
     {
+      const svn_sort__item_t *item;
       const char *path;
       svn_fs_path_change2_t *change;
       svn_boolean_t recurse = TRUE;
 
       svn_pool_clear(subpool);
-      path = APR_ARRAY_IDX(changed_paths_sorted, i, const char *);
+
+      item = &APR_ARRAY_IDX(changed_paths_sorted, i, svn_sort__item_t);
+
+      /* Fetch the change associated with our path.  */
+      path = item->key;
+      change = item->value;
 
       /* If this path has already been verified as part of a recursive
          check of one of its parents, no need to do it again.  */
@@ -3226,9 +3225,6 @@ verify_locks(svn_fs_t *fs,
           && svn_dirent_is_child(last_recursed->data, path, subpool))
         continue;
 
-      /* Fetch the change associated with our path.  */
-      change = svn_hash_gets(changed_paths, path);
-
       /* What does it mean to succeed at lock verification for a given
          path?  For an existing file or directory getting modified
          (text, props), it means we hold the lock on the file or



Mime
View raw message