diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-09 22:38:11 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-09 22:38:11 -0400 |
| commit | 50a227058a8d72f1fb885458b882cedb0e0d7f79 (patch) | |
| tree | c68e86810a6036645278b707430532d9f767c7cc /new/alloc_unix.c | |
| parent | d9315e6d8f528840dd396fbbeb96cb22c8a5df98 (diff) | |
Changed the allocation logging from a compile-time setting to the first initialization option.
Diffstat (limited to 'new/alloc_unix.c')
| -rw-r--r-- | new/alloc_unix.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/new/alloc_unix.c b/new/alloc_unix.c index 238cf39..33482b2 100644 --- a/new/alloc_unix.c +++ b/new/alloc_unix.c @@ -7,9 +7,8 @@ void *uiAlloc(size_t size, const char *type) void *out; out = g_malloc0(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; } @@ -21,16 +20,14 @@ void *uiRealloc(void *p, size_t size, const char *type) return uiAlloc(size, type); // TODO fill with 0s out = g_realloc(p, size); -#ifdef uiLogAllocations - fprintf(stderr, "%p realloc %p\n", p, out); -#endif + if (options.debugLogAllocations) + fprintf(stderr, "%p realloc %p\n", p, out); return out; } void uiFree(void *p) { g_free(p); -#ifdef uiLogAllocations - fprintf(stderr, "%p free\n", p); -#endif + if (options.debugLogAllocations) + fprintf(stderr, "%p free\n", p); } |
