]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] address mem.c compilation problems
authorEvan Hunt <each@isc.org>
Fri, 26 Oct 2012 01:56:47 +0000 (18:56 -0700)
committerEvan Hunt <each@isc.org>
Fri, 26 Oct 2012 01:56:47 +0000 (18:56 -0700)
3406. [bug] mem.c: Fix compilation errors when building with
ISC_MEM_TRACKLINES or ISC_MEMPOOL_NAMES disabled.
                        Also, ISC_MEM_DEBUG is no longer optional. [RT #31559]

CHANGES
lib/isc/include/isc/mem.h
lib/isc/include/isc/namespace.h
lib/isc/mem.c

diff --git a/CHANGES b/CHANGES
index 8046ecfaebe389fe28c2046bfc2b17dc2b0bd7dc..b5a0aab72bdef92640cfbc2a5cd983a5f3b5382b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+3406.  [bug]           mem.c: Fix compilation errors when building with
+                       ISC_MEM_TRACKLINES or ISC_MEMPOOL_NAMES disabled.
+                        Also, ISC_MEM_DEBUG is no longer optional. [RT #31559]
+
 3405.  [bug]           Handle time going backwards in acache. [RT #31253]
 
 3404.  [bug]           dnssec-signzone: When re-signing a zone, remove
index 07fcc1a58b1a7435cccab72f8a6632d7f20fc3d1..ca5e1bbd58bdfd6a12cc23b42195fbb5aff19e1f 100644 (file)
@@ -39,15 +39,6 @@ typedef void (*isc_mem_water_t)(void *, int);
 typedef void * (*isc_memalloc_t)(void *, size_t);
 typedef void (*isc_memfree_t)(void *, void *);
 
-/*%
- * Define ISC_MEM_DEBUG=1 to make all functions that free memory
- * set the pointer being freed to NULL after being freed.
- * This is the default; set ISC_MEM_DEBUG=0 to disable it.
- */
-#ifndef ISC_MEM_DEBUG
-#define ISC_MEM_DEBUG 1
-#endif
-
 /*%
  * Define ISC_MEM_TRACKLINES=1 to turn on detailed tracing of memory
  * allocation and freeing by file and line number.
@@ -276,7 +267,6 @@ struct isc_mempool {
 #define ISCAPI_MPOOL_VALID(mp) ((mp) != NULL && \
                                 (mp)->magic == ISCAPI_MPOOL_MAGIC)
 
-#if ISC_MEM_DEBUG
 #define isc_mem_put(c, p, s) \
        do { \
                ISCMEMFUNC(put)((c), (p), (s) _ISC_MEM_FILELINE);       \
@@ -297,13 +287,6 @@ struct isc_mempool {
                ISCMEMPOOLFUNC(put)((c), (p) _ISC_MEM_FILELINE);        \
                (p) = NULL; \
        } while (0)
-#else
-#define isc_mem_put(c, p, s)   ISCMEMFUNC(put)((c), (p), (s) _ISC_MEM_FILELINE)
-#define isc_mem_putanddetach(c, p, s) \
-       ISCMEMFUNC(putanddetach)((c), (p), (s) _ISC_MEM_FILELINE)
-#define isc_mem_free(c, p)     ISCMEMFUNC(free)((c), (p) _ISC_MEM_FILELINE)
-#define isc_mempool_put(c, p)  ISCMEMPOOLFUNC(put)((c), (p) _ISC_MEM_FILELINE)
-#endif
 
 /*@{*/
 isc_result_t
index 1dbb1a766bd6ee8ddb90a83afabe128eaa19d234..b3a863e182d9aa74b04c50bfb600cf946ea8d2ea 100644 (file)
@@ -73,6 +73,7 @@
 #define isc_mem_isovermem isc__mem_isovermem
 #define isc_mem_setname isc__mem_setname
 #define isc_mem_setwater isc__mem_setwater
+#define isc_mem_printactive isc__mem_printactive
 #define isc_mem_printallactive isc__mem_printallactive
 #define isc_mem_waterack isc__mem_waterack
 #define isc_mempool_create isc__mempool_create
index 8ca081cf8c32be3cca5aa366ba966da767e103aa..c9c625a39c17e6140e162696f4f644f8002d483f 100644 (file)
@@ -202,6 +202,7 @@ struct isc__mempool {
 #if ! ISC_MEM_TRACKLINES
 #define ADD_TRACE(a, b, c, d, e)
 #define DELETE_TRACE(a, b, c, d, e)
+#define ISC_MEMFUNC_SCOPE
 #else
 #define ADD_TRACE(a, b, c, d, e) \
        do { \
@@ -325,6 +326,7 @@ isc__mem_checkdestroyed(FILE *file);
 ISC_MEMFUNC_SCOPE unsigned int
 isc__mem_references(isc_mem_t *ctx0);
 #endif
+#endif /* ISC_MEM_TRACKLINES */
 
 static struct isc__memmethods {
        isc_memmethods_t methods;
@@ -395,6 +397,7 @@ static struct isc__mempoolmethods {
 #endif
 };
 
+#if ISC_MEM_TRACKLINES
 /*!
  * mctx must be locked.
  */
@@ -1484,7 +1487,12 @@ isc__mem_stats(isc_mem_t *ctx0, FILE *out) {
        }
        while (pool != NULL) {
                fprintf(out, "%15s %10lu %10u %10u %10u %10u %10u %10u %s\n",
-                       pool->name, (unsigned long) pool->size, pool->maxalloc,
+#if ISC_MEMPOOL_NAMES
+                       pool->name,
+#else
+                       "(not tracked)",
+#endif
+                       (unsigned long) pool->size, pool->maxalloc,
                        pool->allocated, pool->freecount, pool->freemax,
                        pool->fillcount, pool->gets,
                        (pool->lock == NULL ? "N" : "Y"));
@@ -2296,16 +2304,16 @@ isc__mem_register() {
 #ifdef BIND9
 ISC_MEMFUNC_SCOPE void
 isc__mem_printactive(isc_mem_t *ctx0, FILE *file) {
+#if ISC_MEM_TRACKLINES
        isc__mem_t *ctx = (isc__mem_t *)ctx0;
 
        REQUIRE(VALID_CONTEXT(ctx));
        REQUIRE(file != NULL);
 
-#if !ISC_MEM_TRACKLINES
-       UNUSED(ctx);
-       UNUSED(file);
-#else
        print_active(ctx, file);
+#else
+       UNUSED(ctx0);
+       UNUSED(file);
 #endif
 }
 
@@ -2331,6 +2339,9 @@ isc__mem_printallactive(FILE *file) {
 
 ISC_MEMFUNC_SCOPE void
 isc__mem_checkdestroyed(FILE *file) {
+#if !ISC_MEM_TRACKLINES
+       UNUSED(file);
+#endif
 
        RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);