summaryrefslogtreecommitdiff
path: root/tables
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2005-05-04 12:21:19 +0000
committerJoe Orton <jorton@apache.org>2005-05-04 12:21:19 +0000
commite215646fbc38017513ea44ec006798a7af786fba (patch)
tree3af4ff588a138c7752c81624390473030503ecb1 /tables
parentfbd6061a1cf97c7fc732ba91a216ad722396ab6b (diff)
downloadapr-e215646fbc38017513ea44ec006798a7af786fba.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: https://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);