rbb 00/11/30 22:27:16
Modified: include apr_pools.h
lib apr_pools.c
Log:
Change POOL_DEBUG into APR_POOL_DEBUG. This allows us to detect the macro
when we scan the APR header files to generate the export list. If we
use POOL_DEBUG, then we can't determine when the debug functions are
available and when they aren't.
Revision Changes Path
1.35 +21 -22 apr/include/apr_pools.h
Index: apr_pools.h
===================================================================
RCS file: /home/cvs/apr/include/apr_pools.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- apr_pools.h 2000/11/29 01:09:15 1.34
+++ apr_pools.h 2000/12/01 06:27:15 1.35
@@ -97,7 +97,7 @@
/*
#define ALLOC_DEBUG
-#define POOL_DEBUG
+#define APR_POOL_DEBUG
#define ALLOC_USE_MALLOC
#define MAKE_TABLE_PROFILE
#define ALLOC_STATS
@@ -133,7 +133,7 @@
/** The allocation list if using malloc */
void *allocation_list;
#endif
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
/** a list of joined pools
* @defvar apr_pool_t *joined */
struct apr_pool_t *joined;
@@ -165,8 +165,8 @@
*
* In general we say that it is safe to insert data into a table T
* if the data is allocated in any ancestor of T's pool. This is the
- * basis on which the POOL_DEBUG code works -- it tests these ancestor
- * relationships for all data inserted into tables. POOL_DEBUG also
+ * basis on which the APR_POOL_DEBUG code works -- it tests these ancestor
+ * relationships for all data inserted into tables. APR_POOL_DEBUG also
* provides tools (apr_find_pool, and apr_pool_is_ancestor) for other
* folks to implement similar restrictions for their own data
* structures.
@@ -180,18 +180,27 @@
* parent pool.
*
* In this case the caller must call apr_pool_join() to indicate this
- * guarantee to the POOL_DEBUG code. There are a few examples spread
+ * guarantee to the APR_POOL_DEBUG code. There are a few examples spread
* through the standard modules.
*/
-#ifndef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
+APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub);
+APR_DECLARE(apr_pool_t *) apr_find_pool(const void *ts);
+
+/**
+ * Determine if pool a is an ancestor of pool b
+ * @param a The pool to search
+ * @param b The pool to search for
+ * @return True if a is an ancestor of b, NULL is considered an ancestor
+ * of all pools.
+ * @deffunc int apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b)
+ */
+APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b);
+#else
#ifdef apr_pool_join
#undef apr_pool_join
#endif
#define apr_pool_join(a,b)
-#else
-APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub);
-APR_DECLARE(apr_pool_t *) apr_find_pool(const void *ts);
-APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b);
#endif
#ifdef ULTRIX_BRAIN_DEATH
@@ -302,16 +311,6 @@
APR_DECLARE(apr_size_t) apr_bytes_in_free_blocks(void);
/**
- * Determine if pool a is an ancestor of pool b
- * @param a The pool to search
- * @param b The pool to search for
- * @return True if a is an ancestor of b, NULL is considered an ancestor
- * of all pools.
- * @deffunc int apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b)
- */
-APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b);
-
-/**
* Allocate a block of memory from a pool
* @param c The pool to allocate out of
* @param reqsize The amount of memory to allocate
@@ -383,12 +382,12 @@
/* used to guarantee to the apr_pool_t debugging code that the sub
apr_pool_t will not be
* destroyed before the parent pool
*/
-#ifndef POOL_DEBUG
+#ifndef APR_POOL_DEBUG
#ifdef apr_pool_join
#undef apr_pool_join
#endif /* apr_pool_join */
#define apr_pool_join(a,b)
-#endif /* POOL_DEBUG */
+#endif /* APR_POOL_DEBUG */
#ifdef __cplusplus
}
1.73 +21 -21 apr/lib/apr_pools.c
Index: apr_pools.c
===================================================================
RCS file: /home/cvs/apr/lib/apr_pools.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- apr_pools.c 2000/11/26 02:59:56 1.72
+++ apr_pools.c 2000/12/01 06:27:16 1.73
@@ -117,17 +117,17 @@
#define BLOCK_MINALLOC 8192
#endif
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
/* first do some option checking... */
#ifdef ALLOC_USE_MALLOC
-#error "sorry, no support for ALLOC_USE_MALLOC and POOL_DEBUG at the same
time"
+#error "sorry, no support for ALLOC_USE_MALLOC and APR_POOL_DEBUG at the
same time"
#endif /* ALLOC_USE_MALLOC */
#ifdef MULTITHREAD
-# error "sorry, no support for MULTITHREAD and POOL_DEBUG at the same time"
+# error "sorry, no support for MULTITHREAD and APR_POOL_DEBUG at the same
time"
#endif /* MULTITHREAD */
-#endif /* POOL_DEBUG */
+#endif /* APR_POOL_DEBUG */
#ifdef ALLOC_USE_MALLOC
#undef BLOCK_MINFREE
@@ -169,10 +169,10 @@
char *endp;
union block_hdr *next;
char *first_avail;
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
union block_hdr *global_next;
apr_pool_t *owning_pool;
-#endif /* POOL_DEBUG */
+#endif /* APR_POOL_DEBUG */
} h;
};
@@ -197,12 +197,12 @@
static apr_lock_t *spawn_mutex;
#endif
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
static char *known_stack_point;
static int stack_direction;
static union block_hdr *global_block_list;
#define FREE_POOL ((apr_pool_t *)(-1))
-#endif /* POOL_DEBUG */
+#endif /* APR_POOL_DEBUG */
#ifdef ALLOC_STATS
static unsigned long long num_free_blocks_calls;
@@ -267,11 +267,11 @@
blok->h.endp -= CLICK_SZ;
#endif /* ALLOC_DEBUG */
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
blok->h.global_next = global_block_list;
global_block_list = blok;
blok->h.owning_pool = NULL;
-#endif /* POOL_DEBUG */
+#endif /* APR_POOL_DEBUG */
return blok;
}
@@ -351,18 +351,18 @@
chk_on_blk_list(blok, old_free_list);
blok->h.first_avail = (char *) (blok + 1);
debug_fill(blok->h.first_avail, blok->h.endp - blok->h.first_avail);
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
blok->h.owning_pool = FREE_POOL;
-#endif /* POOL_DEBUG */
+#endif /* APR_POOL_DEBUG */
blok = blok->h.next;
}
chk_on_blk_list(blok, old_free_list);
blok->h.first_avail = (char *) (blok + 1);
debug_fill(blok->h.first_avail, blok->h.endp - blok->h.first_avail);
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
blok->h.owning_pool = FREE_POOL;
-#endif /* POOL_DEBUG */
+#endif /* APR_POOL_DEBUG */
/* Finally, reset next pointer to get the old free blocks back */
@@ -474,7 +474,7 @@
blok = new_block(POOL_HDR_BYTES, apr_abort);
new_pool = (apr_pool_t *) blok->h.first_avail;
blok->h.first_avail += POOL_HDR_BYTES;
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
blok->h.owning_pool = new_pool;
#endif
@@ -501,7 +501,7 @@
return new_pool;
}
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
static void stack_var_init(char *s)
{
char t;
@@ -639,7 +639,7 @@
#if APR_HAS_THREADS
apr_status_t status;
#endif
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
char s;
known_stack_point = &s;
@@ -750,9 +750,9 @@
}
/*****************************************************************
- * POOL_DEBUG support
+ * APR_POOL_DEBUG support
*/
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
/* the unix linker defines this symbol as the last byte + 1 of
* the executable... so it includes TEXT, BSS, and DATA
@@ -939,7 +939,7 @@
blok = new_block(size, a->apr_abort);
a->last->h.next = blok;
a->last = blok;
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
blok->h.owning_pool = a;
#endif
@@ -1097,7 +1097,7 @@
if (ps.got_a_new_block) {
p->last->h.next = ps.blok;
p->last = ps.blok;
-#ifdef POOL_DEBUG
+#ifdef APR_POOL_DEBUG
ps.blok->h.owning_pool = p;
#endif
}