Author: hartmannathan
Date: Sun May 24 16:09:35 2020
New Revision: 1878084
URL: http://svn.apache.org/viewvc?rev=1878084&view=rev
Log:
Fix an inefficient way to fill an array of inherited properties.
The code that obtains inherited properties for servers that don't support the
capability used an inefficient way of array filling. At each iteration, all
previously added properties were moved one position to the right to maintain
depth-first order. As a solution, walk the array of iprop requests from the
end and get rid of extra copying of array elements.
* subversion/libsvn_ra_serf/inherited_props.c
(): Remove unused 'svn_sorts.h' and 'private/svn_sorts_private.h' includes.
(get_iprops_via_more_requests): Walk the array of iprop requests from the
end.
Patch by: Denis Kovalchuk <denis.kovalchuk{_AT_}visualsvn.com>
Review by: brane
Modified:
subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c?rev=1878084&r1=1878083&r2=1878084&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/inherited_props.c Sun May 24
16:09:35 2020
@@ -28,14 +28,12 @@
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_ra.h"
-#include "svn_sorts.h"
#include "svn_string.h"
#include "svn_xml.h"
#include "svn_props.h"
#include "svn_base64.h"
#include "private/svn_dav_protocol.h"
-#include "private/svn_sorts_private.h"
#include "../libsvn_ra/ra_loader.h"
#include "svn_private_config.h"
#include "ra_serf.h"
@@ -314,8 +312,8 @@ get_iprops_via_more_requests(svn_ra_sess
*iprops = apr_array_make(result_pool, rq_info->nelts,
sizeof(svn_prop_inherited_item_t *));
- /* And now create the result set */
- for (i = 0; i < rq_info->nelts; i++)
+ /* And now create the result set in depth-first order. */
+ for (i = rq_info->nelts - 1; i >= 0; i--)
{
iprop_rq_info_t *rq = APR_ARRAY_IDX(rq_info, i, iprop_rq_info_t *);
apr_hash_t *node_props;
@@ -340,7 +338,7 @@ get_iprops_via_more_requests(svn_ra_sess
new_iprop = apr_palloc(result_pool, sizeof(*new_iprop));
new_iprop->path_or_url = apr_pstrdup(result_pool, rq->relpath);
new_iprop->prop_hash = svn_prop_hash_dup(node_props, result_pool);
- SVN_ERR(svn_sort__array_insert2(*iprops, &new_iprop, 0));
+ APR_ARRAY_PUSH(*iprops, svn_prop_inherited_item_t *) = new_iprop;
}
return SVN_NO_ERROR;