Commit 2f57f353 authored by Evan Hunt's avatar Evan Hunt
Browse files

[master] address mem.c compilation problems

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]
parent e2375750
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
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment