summaryrefslogtreecommitdiff
path: root/memory
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2005-05-04 11:30:27 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2005-05-04 11:30:27 +0000
commitd72b70072b23cf56a2c48dd347fa22b6fdcfc6a2 (patch)
treeaaa849118b86c0c7dcb7bdbb40001baf2b4cc963 /memory
parentfbb8cec73234780ccbe29294943bb75311732c56 (diff)
downloadlibapr-d72b70072b23cf56a2c48dd347fa22b6fdcfc6a2.tar.gz
Steal the joined-pool debug code from 1.3:
* include/apr_pools.h (apr_pool_is_ancestor): Note special semantics for joined pools. * memory/unix/apr_pools.c (apr_pool_join): Implement. (apr_pool_is_ancestor): Adjust for joined pools. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@168115 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory')
-rw-r--r--memory/unix/apr_pools.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index bf970e295..623813551 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -456,6 +456,8 @@ struct apr_pool_t {
char *self_first_avail;
#else /* APR_POOL_DEBUG */
+ apr_pool_t *joined; /* the caller has guaranteed that this pool
+ * will survive as long as ->joined */
debug_node_t *nodes;
const char *file_line;
apr_uint32_t creation_flags;
@@ -1655,6 +1657,12 @@ APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap)
APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub)
{
+#if APR_POOL_DEBUG
+ if (sub->parent != p) {
+ abort();
+ }
+ sub->joined = p;
+#endif
}
static int pool_find(apr_pool_t *pool, void *data)
@@ -1805,6 +1813,14 @@ APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b)
if (a == NULL)
return 1;
+#if APR_POOL_DEBUG
+ /* Find the pool with the longest lifetime guaranteed by the
+ * caller: */
+ while (a->joined) {
+ a = a->joined;
+ }
+#endif
+
while (b) {
if (a == b)
return 1;