diff options
Diffstat (limited to 'libc/stdlib/malloc/malloc.h')
-rw-r--r-- | libc/stdlib/malloc/malloc.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 30a28b776..4071a4ffb 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -122,10 +122,13 @@ extern malloc_mutex_t __malloc_sbrk_lock; #endif /* !likely */ -/* Define MALLOC_DEBUGGING to cause malloc to emit debugging info to stderr. */ +/* Define MALLOC_DEBUGGING to cause malloc to emit debugging info to stderr + when the variable __malloc_debug is set to true. */ #ifdef MALLOC_DEBUGGING #include <stdio.h> -#define MALLOC_DEBUG(fmt, args...) fprintf (stderr, fmt , ##args) +extern int __malloc_debug; +#define MALLOC_DEBUG(fmt, args...) \ + (__malloc_debug ? fprintf (stderr, fmt , ##args) : 0) #else #define MALLOC_DEBUG(fmt, args...) (void)0 #endif |