From dbf48e757bd7ee4380f332714b74dffdaadd746c Mon Sep 17 00:00:00 2001 From: jorton Date: Wed, 4 May 2005 12:21:19 +0000 Subject: * tables/apr_tables.c (apr_table_overlap): Don't erase dest table array if the pools differ; add pool-lifetime debugging check. Submitted by: Joe Schaefer git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@168118 13f79535-47bb-0310-9956-ffa450edef68 --- tables/apr_tables.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tables') diff --git a/tables/apr_tables.c b/tables/apr_tables.c index e86c1becc..da17e2867 100644 --- a/tables/apr_tables.c +++ b/tables/apr_tables.c @@ -1191,18 +1191,18 @@ static void apr_table_cat(apr_table_t *t, const apr_table_t *s) APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b, unsigned flags) { - const int m = a->a.nelts; - const int n = b->a.nelts; - apr_pool_t *p = b->a.pool; - - if (m + n == 0) { + if (a->a.nelts + b->a.nelts == 0) { return; } - /* copy (extend) a using b's pool */ - if (a->a.pool != p) { - make_array_core(&a->a, p, m+n, sizeof(apr_table_entry_t), 0); +#if APR_POOL_DEBUG + /* Since the keys and values are not copied, it's required that + * b->a.pool has a lifetime at least as long as a->a.pool. */ + if (!apr_pool_is_ancestor(b->a.pool, a->a.pool)) { + fprintf(stderr, "apr_table_overlap: b's pool is not an ancestor of a's\n"); + abort(); } +#endif apr_table_cat(a, b); -- cgit v1.2.1