From 729843b85e876a4c49662a97b01d6ac2106a9ea9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 26 Apr 2020 23:37:29 +0200 Subject: ta: change debug ifdeffery TA_MEMORY_DEBUGGING always defined. But allow defining it from the compiler command line (-D), because maybe that's useful for someone? --- ta/ta.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ta/ta.c b/ta/ta.c index 275c8025b1..a0eabbd3e9 100644 --- a/ta/ta.c +++ b/ta/ta.c @@ -25,8 +25,12 @@ // make sense to set this value higher than malloc's alignment. #define MIN_ALIGN 16 -#ifndef NDEBUG -#define TA_MEMORY_DEBUGGING +#if !defined(TA_MEMORY_DEBUGGING) + #if !defined(NDEBUG) + #define TA_MEMORY_DEBUGGING 1 + #else + #define TA_MEMORY_DEBUGGING 0 + #endif #endif struct ta_header { @@ -38,7 +42,7 @@ struct ta_header { struct ta_header *child; // points to first child struct ta_header *parent; // set for _first_ child only, NULL otherwise void (*destructor)(void *); -#ifdef TA_MEMORY_DEBUGGING +#if TA_MEMORY_DEBUGGING unsigned int canary; struct ta_header *leak_next; struct ta_header *leak_prev; @@ -251,7 +255,7 @@ void ta_set_destructor(void *ptr, void (*destructor)(void *)) h->destructor = destructor; } -#ifdef TA_MEMORY_DEBUGGING +#if TA_MEMORY_DEBUGGING #include -- cgit v1.2.3