diff options
author | wm4 <wm4@nowhere> | 2020-04-26 23:37:29 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-04-26 23:37:29 +0200 |
commit | 729843b85e876a4c49662a97b01d6ac2106a9ea9 (patch) | |
tree | 9d4f50507fd3c6c632858c0221c002f85a698e3a | |
parent | e9e883e3b2a64867aae014fb8a1416d0177fe493 (diff) | |
download | mpv-729843b85e876a4c49662a97b01d6ac2106a9ea9.tar.bz2 mpv-729843b85e876a4c49662a97b01d6ac2106a9ea9.tar.xz |
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?
-rw-r--r-- | ta/ta.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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 <pthread.h> |