[v9_6] 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]
(cherry picked from commit 2f57f353e8)
(cherry picked from commit 76e34eb2fd)
(cherry picked from commit 7c5941b4c2)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
@@ -187,7 +178,6 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_debugging;
|
||||
* \endcode
|
||||
*/
|
||||
|
||||
#if ISC_MEM_DEBUG
|
||||
#define isc_mem_put(c, p, s) \
|
||||
do { \
|
||||
isc__mem_put((c), (p), (s) _ISC_MEM_FILELINE); \
|
||||
@@ -208,13 +198,6 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_debugging;
|
||||
isc__mempool_put((c), (p) _ISC_MEM_FILELINE); \
|
||||
(p) = NULL; \
|
||||
} while (0)
|
||||
#else
|
||||
#define isc_mem_put(c, p, s) isc__mem_put((c), (p), (s) _ISC_MEM_FILELINE)
|
||||
#define isc_mem_putanddetach(c, p, s) \
|
||||
isc__mem_putanddetach((c), (p), (s) _ISC_MEM_FILELINE)
|
||||
#define isc_mem_free(c, p) isc__mem_free((c), (p) _ISC_MEM_FILELINE)
|
||||
#define isc_mempool_put(c, p) isc__mempool_put((c), (p) _ISC_MEM_FILELINE)
|
||||
#endif
|
||||
|
||||
/*@{*/
|
||||
isc_result_t
|
||||
|
||||
+13
-4
@@ -199,6 +199,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 { \
|
||||
@@ -1294,7 +1295,12 @@ isc_mem_stats(isc_mem_t *ctx, 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"));
|
||||
@@ -2025,15 +2031,15 @@ isc_mempool_getfillcount(isc_mempool_t *mpctx) {
|
||||
|
||||
void
|
||||
isc_mem_printactive(isc_mem_t *ctx, FILE *file) {
|
||||
#if ISC_MEM_TRACKLINES
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
REQUIRE(file != NULL);
|
||||
|
||||
#if !ISC_MEM_TRACKLINES
|
||||
print_active(ctx, file);
|
||||
#else
|
||||
UNUSED(ctx);
|
||||
UNUSED(file);
|
||||
#else
|
||||
print_active(ctx, file);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2059,6 +2065,9 @@ isc_mem_printallactive(FILE *file) {
|
||||
|
||||
void
|
||||
isc_mem_checkdestroyed(FILE *file) {
|
||||
#if !ISC_MEM_TRACKLINES
|
||||
UNUSED(file);
|
||||
#endif
|
||||
|
||||
RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user