subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1294240 - /subversion/trunk/subversion/libsvn_repos/replay.c
Date Mon, 27 Feb 2012 17:34:30 GMT
Author: hwright
Date: Mon Feb 27 17:34:30 2012
New Revision: 1294240

URL: http://svn.apache.org/viewvc?rev=1294240&view=rev
Log:
Use an array of pointers, rather than an array of structs.

This better matches our typical pattern throughout the code, at the loss of
spacial locality, though the typical use cases don't take advantage of it
anyway.  We also avoid copying structs when the array grows.

* subversion/libsvn_repos/replay.c
  (was_readable): Fetch pointers, rather than structs.
  (path_driver_cb_func): Insert pointers, rather than full structs.
  (svn_repos_replay2): Initialize the array with the correct element size.

Modified:
    subversion/trunk/subversion/libsvn_repos/replay.c

Modified: subversion/trunk/subversion/libsvn_repos/replay.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/replay.c?rev=1294240&r1=1294239&r2=1294240&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/replay.c (original)
+++ subversion/trunk/subversion/libsvn_repos/replay.c Mon Feb 27 17:34:30 2012
@@ -378,7 +378,7 @@ was_readable(svn_boolean_t *readable,
     }
 
   if (copies->nelts != 0)
-    info = &APR_ARRAY_IDX(copies, copies->nelts - 1, struct copy_info);
+    info = APR_ARRAY_IDX(copies, copies->nelts - 1, struct copy_info *);
 
   /* Are we under a copy? */
   if (info && (relpath = svn_relpath_skip_ancestor(info->path, path)))
@@ -493,7 +493,7 @@ path_driver_cb_func(void **dir_baton,
   while (cb->copies->nelts > 0
          && ! svn_dirent_is_ancestor(APR_ARRAY_IDX(cb->copies,
                                                    cb->copies->nelts - 1,
-                                                   struct copy_info).path,
+                                                   struct copy_info *)->path,
                                      edit_path))
     apr_array_pop(cb->copies);
 
@@ -613,11 +613,13 @@ path_driver_cb_func(void **dir_baton,
              (possibly nested) copy operation. */
           if (change->node_kind == svn_node_dir)
             {
-              struct copy_info *info = &APR_ARRAY_PUSH(cb->copies,
-                                                       struct copy_info);
+              struct copy_info *info = apr_pcalloc(cb->pool, sizeof(*info));
+
               info->path = apr_pstrdup(cb->pool, edit_path);
               info->copyfrom_path = apr_pstrdup(cb->pool, copyfrom_path);
               info->copyfrom_rev = copyfrom_rev;
+
+              APR_ARRAY_PUSH(cb->copies, struct copy_info *) = info;
             }
 
           /* Save the source so that we can use it later, when we
@@ -633,11 +635,13 @@ path_driver_cb_func(void **dir_baton,
              past... */
           if (change->node_kind == svn_node_dir && cb->copies->nelts >
0)
             {
-              struct copy_info *info = &APR_ARRAY_PUSH(cb->copies,
-                                                       struct copy_info);
+              struct copy_info *info = apr_pcalloc(cb->pool, sizeof(*info));
+
               info->path = apr_pstrdup(cb->pool, edit_path);
               info->copyfrom_path = NULL;
               info->copyfrom_rev = SVN_INVALID_REVNUM;
+
+              APR_ARRAY_PUSH(cb->copies, struct copy_info *) = info;
             }
           source_root = NULL;
           source_fspath = NULL;
@@ -670,9 +674,9 @@ path_driver_cb_func(void **dir_baton,
          delta source. */
       if (cb->copies->nelts > 0)
         {
-          struct copy_info *info = &APR_ARRAY_IDX(cb->copies,
-                                                  cb->copies->nelts - 1,
-                                                  struct copy_info);
+          struct copy_info *info = APR_ARRAY_IDX(cb->copies,
+                                                 cb->copies->nelts - 1,
+                                                 struct copy_info *);
           if (info->copyfrom_path)
             {
               const char *relpath = svn_relpath_skip_ancestor(info->path,
@@ -894,7 +898,7 @@ svn_repos_replay2(svn_fs_root_t *root,
                                    pool));
     }
 
-  cb_baton.copies = apr_array_make(pool, 4, sizeof(struct copy_info));
+  cb_baton.copies = apr_array_make(pool, 4, sizeof(struct copy_info *));
   cb_baton.pool = pool;
 
   /* Determine the revision to use throughout the edit, and call



Mime
View raw message