You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2005/05/04 14:21:20 UTC
svn commit: r168118 - in /apr/apr/trunk: CHANGES tables/apr_tables.c
Author: jorton
Date: Wed May 4 05:21:19 2005
New Revision: 168118
URL: http://svn.apache.org/viewcvs?rev=168118&view=rev
Log:
* 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 <jo...@sunstarsys.com>
Modified:
apr/apr/trunk/CHANGES
apr/apr/trunk/tables/apr_tables.c
Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/CHANGES?rev=168118&r1=168117&r2=168118&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES (original)
+++ apr/apr/trunk/CHANGES Wed May 4 05:21:19 2005
@@ -1,5 +1,8 @@
Changes for APR 1.2.0
+ *) Fix apr_table_overlap()'s handling of tables allocated from
+ different pools. [Joe Schaefer <jo...@sunstarsys.com>]
+
*) Add support for uuid_generate on OS X 10.4. [Paul Querna]
*) Include the C preprocessor flags in --cflags for pkg-config.
Modified: apr/apr/trunk/tables/apr_tables.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/tables/apr_tables.c?rev=168118&r1=168117&r2=168118&view=diff
==============================================================================
--- apr/apr/trunk/tables/apr_tables.c (original)
+++ apr/apr/trunk/tables/apr_tables.c Wed May 4 05:21:19 2005
@@ -1191,18 +1191,18 @@
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);