You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/11/10 14:21:16 UTC

svn commit: r1033455 - /subversion/trunk/subversion/libsvn_subr/constructors.c

Author: julianfoad
Date: Wed Nov 10 13:21:15 2010
New Revision: 1033455

URL: http://svn.apache.org/viewvc?rev=1033455&view=rev
Log:
A small run-time optimization.  When duplicating structures, don't
initialize the new memory when the next step completely overwrites it.

* subversion/libsvn_subr/constructors.c
  (svn_commit_info_dup, svn_log_changed_path2_dup, svn_log_entry_dup,
   svn_location_segment_dup): Get the new memory with apr_palloc() rather
    than apr_pcalloc() or a structure-specific creation function.

Modified:
    subversion/trunk/subversion/libsvn_subr/constructors.c

Modified: subversion/trunk/subversion/libsvn_subr/constructors.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/constructors.c?rev=1033455&r1=1033454&r2=1033455&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/constructors.c (original)
+++ subversion/trunk/subversion/libsvn_subr/constructors.c Wed Nov 10 13:21:15 2010
@@ -45,7 +45,8 @@ svn_commit_info_t *
 svn_commit_info_dup(const svn_commit_info_t *src_commit_info,
                     apr_pool_t *pool)
 {
-  svn_commit_info_t *dst_commit_info = svn_create_commit_info(pool);
+  svn_commit_info_t *dst_commit_info
+    = apr_palloc(pool, sizeof(*dst_commit_info));
 
   dst_commit_info->date = src_commit_info->date
     ? apr_pstrdup(pool, src_commit_info->date) : NULL;
@@ -74,7 +75,7 @@ svn_log_changed_path2_dup(const svn_log_
                           apr_pool_t *pool)
 {
   svn_log_changed_path2_t *new_changed_path
-    = svn_log_changed_path2_create(pool);
+    = apr_palloc(pool, sizeof(*new_changed_path));
 
   *new_changed_path = *changed_path;
 
@@ -190,7 +191,7 @@ svn_log_entry_t *
 svn_log_entry_dup(const svn_log_entry_t *log_entry, apr_pool_t *pool)
 {
   apr_hash_index_t *hi;
-  svn_log_entry_t *new_entry = svn_log_entry_create(pool);
+  svn_log_entry_t *new_entry = apr_palloc(pool, sizeof(*new_entry));
 
   *new_entry = *log_entry;
 
@@ -228,7 +229,8 @@ svn_location_segment_dup(const svn_locat
                          apr_pool_t *pool)
 {
   svn_location_segment_t *new_segment =
-    apr_pcalloc(pool, sizeof(*new_segment));
+    apr_palloc(pool, sizeof(*new_segment));
+
   *new_segment = *segment;
   if (segment->path)
     new_segment->path = apr_pstrdup(pool, segment->path);