summaryrefslogtreecommitdiff
path: root/tables
diff options
context:
space:
mode:
authorianh <ianh@13f79535-47bb-0310-9956-ffa450edef68>2001-12-08 05:01:59 +0000
committerianh <ianh@13f79535-47bb-0310-9956-ffa450edef68>2001-12-08 05:01:59 +0000
commit2517e4430ac8d776c64a0f10dab6547a7b018ab2 (patch)
tree89c6b7271e28c09e1eb7cf68d1e3d4ce7a4897a4 /tables
parent73b477352e6e67ff739dbfa3b6483e3831d7f5e4 (diff)
downloadlibapr-2517e4430ac8d776c64a0f10dab6547a7b018ab2.tar.gz
optimize the apr_array_copy call by remvoing the zero fill
Thanks Brian! Obtained from: Brian Pane <bpane@pacbell.net> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62611 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tables')
-rw-r--r--tables/apr_tables.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tables/apr_tables.c b/tables/apr_tables.c
index cbf5a0eeb..7827b9964 100644
--- a/tables/apr_tables.c
+++ b/tables/apr_tables.c
@@ -167,10 +167,14 @@ APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst,
APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p,
const apr_array_header_t *arr)
{
- apr_array_header_t *res = apr_array_make(p, arr->nalloc, arr->elt_size);
+ apr_array_header_t *res =
+ (apr_array_header_t *) apr_palloc(p, sizeof(apr_array_header_t));
+ make_array_core(res, p, arr->nalloc, arr->elt_size, 0);
memcpy(res->elts, arr->elts, arr->elt_size * arr->nelts);
res->nelts = arr->nelts;
+ memset(res->elts + res->elt_size * res->nelts, 0,
+ res->elt_size * (res->nalloc - res->nelts));
return res;
}