summaryrefslogtreecommitdiff
path: root/tables
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2005-05-04 12:21:19 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2005-05-04 12:21:19 +0000
commitdbf48e757bd7ee4380f332714b74dffdaadd746c (patch)
tree3af4ff588a138c7752c81624390473030503ecb1 /tables
parentd8e1c941fc07ad80cf0e98b1859a20b722091c0b (diff)
downloadlibapr-dbf48e757bd7ee4380f332714b74dffdaadd746c.tar.gz
* 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 <joe+gmane@sunstarsys.com> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@168118 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tables')
-rw-r--r--tables/apr_tables.c16
1 files changed, 8 insertions, 8 deletions
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);