summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/malloc_debug.c
diff options
context:
space:
mode:
authorMiles Bader <miles@lsi.nec.co.jp>2002-11-21 07:52:46 +0000
committerMiles Bader <miles@lsi.nec.co.jp>2002-11-21 07:52:46 +0000
commit8c61ed7fd4b032c57ee39ed171dd1ba001637b42 (patch)
treec8cefef8b3f424a053e141dd9065d38202c0cf60 /libc/stdlib/malloc/malloc_debug.c
parent22119008112a4abb723a48ea54b8c9626c449db9 (diff)
Debugging tweaks.
Diffstat (limited to 'libc/stdlib/malloc/malloc_debug.c')
-rw-r--r--libc/stdlib/malloc/malloc_debug.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libc/stdlib/malloc/malloc_debug.c b/libc/stdlib/malloc/malloc_debug.c
index 20a37f2f0..d231fa7b6 100644
--- a/libc/stdlib/malloc/malloc_debug.c
+++ b/libc/stdlib/malloc/malloc_debug.c
@@ -19,9 +19,7 @@
#include "malloc.h"
#include "heap.h"
-#ifdef MALLOC_DEBUGGING
int __malloc_debug = 0, __malloc_check = 0;
-#endif
#ifdef MALLOC_MMB_DEBUGGING
int __malloc_mmb_debug = 0;
@@ -36,11 +34,14 @@ int __malloc_debug_cur_indent = 0;
void
__malloc_debug_printf (int indent, const char *fmt, ...)
{
- int i;
+ unsigned spaces = __malloc_debug_cur_indent * MALLOC_DEBUG_INDENT_SIZE;
va_list val;
- for (i = 0; i < __malloc_debug_cur_indent; i++)
- fputs (" ", stderr);
+ while (spaces > 0)
+ {
+ putc (' ', stderr);
+ spaces--;
+ }
va_start (val, fmt);
vfprintf (stderr, fmt, val);
@@ -58,13 +59,13 @@ __malloc_debug_init (void)
if (ev)
{
int val = atoi (ev);
+
if (val & 1)
__malloc_check = 1;
-#ifdef MALLOC_DEBUGGING
if (val & 2)
__malloc_debug = 1;
-#endif
+
#ifdef MALLOC_MMB_DEBUGGING
if (val & 4)
__malloc_mmb_debug = 1;