summaryrefslogtreecommitdiffstats
path: root/libdimension/malloc.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-06-12 10:23:45 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-06-12 10:27:13 -0400
commit453bb6c1b79d6d4fe4b1277336dc0f4097a5ee6b (patch)
treeb8d4627503708b047230c7148dbceae63100a462 /libdimension/malloc.c
parent399bc22aff7f1042199cbc425d1df5264d1741af (diff)
downloaddimension-453bb6c1b79d6d4fe4b1277336dc0f4097a5ee6b.tar.xz
Use DMNSN_DEBUG macro instead of NDEBUG.
Diffstat (limited to 'libdimension/malloc.c')
-rw-r--r--libdimension/malloc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libdimension/malloc.c b/libdimension/malloc.c
index 786a2dc..2e4969d 100644
--- a/libdimension/malloc.c
+++ b/libdimension/malloc.c
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdatomic.h>
-#ifndef NDEBUG
+#if DMNSN_DEBUG
static atomic_size_t dmnsn_allocs = ATOMIC_VAR_INIT(0);
#endif
@@ -40,7 +40,7 @@ dmnsn_malloc(size_t size)
dmnsn_error("Memory allocation failed.");
}
-#ifndef NDEBUG
+#if DMNSN_DEBUG
atomic_fetch_add(&dmnsn_allocs, 1);
#endif
@@ -50,7 +50,7 @@ dmnsn_malloc(size_t size)
void *
dmnsn_realloc(void *ptr, size_t size)
{
-#ifndef NDEBUG
+#if DMNSN_DEBUG
if (!ptr) {
atomic_fetch_add(&dmnsn_allocs, 1);
}
@@ -74,7 +74,7 @@ dmnsn_strdup(const char *s)
void
dmnsn_free(void *ptr)
{
-#ifndef NDEBUG
+#if DMNSN_DEBUG
if (ptr) {
atomic_fetch_sub(&dmnsn_allocs, 1);
}
@@ -83,7 +83,7 @@ dmnsn_free(void *ptr)
free(ptr);
}
-#ifndef NDEBUG
+#if DMNSN_DEBUG
DMNSN_LATE_DESTRUCTOR static void
dmnsn_leak_check(void)
{