summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/malloc.h
diff options
context:
space:
mode:
authorMiles Bader <miles@lsi.nec.co.jp>2002-09-06 04:58:53 +0000
committerMiles Bader <miles@lsi.nec.co.jp>2002-09-06 04:58:53 +0000
commit73f88c8f7e9733dd3252b464f5ca0108ff7297c4 (patch)
treee4cfa77ff344a5b929f4c592d744282661f7cf9a /libc/stdlib/malloc/malloc.h
parente228070ee1857944afad5571eae50b8c6e2430c8 (diff)
Update debugging hooks.
Diffstat (limited to 'libc/stdlib/malloc/malloc.h')
-rw-r--r--libc/stdlib/malloc/malloc.h7
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