summaryrefslogtreecommitdiff
path: root/new/alloc_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-09 22:38:11 -0400
committerPietro Gagliardi <[email protected]>2015-04-09 22:38:11 -0400
commit50a227058a8d72f1fb885458b882cedb0e0d7f79 (patch)
treec68e86810a6036645278b707430532d9f767c7cc /new/alloc_darwin.m
parentd9315e6d8f528840dd396fbbeb96cb22c8a5df98 (diff)
Changed the allocation logging from a compile-time setting to the first initialization option.
Diffstat (limited to 'new/alloc_darwin.m')
-rw-r--r--new/alloc_darwin.m15
1 files changed, 6 insertions, 9 deletions
diff --git a/new/alloc_darwin.m b/new/alloc_darwin.m
index df29566..83a948e 100644
--- a/new/alloc_darwin.m
+++ b/new/alloc_darwin.m
@@ -11,9 +11,8 @@ void *uiAlloc(size_t size, const char *type)
out = malloc(size);
NSCAssert(out != NULL, @"out of memory in uiAlloc()");
memset(out, 0, size);
-#ifdef uiLogAllocations
- fprintf(stderr, "%p alloc %s\n", out, type);
-#endif
+ if (options.debugLogAllocations)
+ fprintf(stderr, "%p alloc %s\n", out, type);
return out;
}
@@ -26,9 +25,8 @@ void *uiRealloc(void *p, size_t size, const char *type)
out = realloc(p, size);
NSCAssert(out != NULL, @"out of memory in uiRealloc()");
// TODO zero the extra memory
-#ifdef uiLogAllocations
- fprintf(stderr, "%p realloc %p\n", p, out);
-#endif
+ if (options.debugLogAllocations)
+ fprintf(stderr, "%p realloc %p\n", p, out);
return out;
}
@@ -37,7 +35,6 @@ void uiFree(void *p)
if (p == NULL)
return;
free(p);
-#ifdef uiLogAllocations
- fprintf(stderr, "%p free\n", p);
-#endif
+ if (options.debugLogAllocations)
+ fprintf(stderr, "%p free\n", p);
}