summaryrefslogtreecommitdiffstats
path: root/common/eurephia_nullsafe.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/eurephia_nullsafe.c')
-rw-r--r--common/eurephia_nullsafe.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/common/eurephia_nullsafe.c b/common/eurephia_nullsafe.c
index 2536d4b..5f507c3 100644
--- a/common/eurephia_nullsafe.c
+++ b/common/eurephia_nullsafe.c
@@ -71,10 +71,15 @@ __malloc__ void *_malloc_nullsafe(eurephiaCTX *ctx, size_t sz, const char *file,
"Could not allocate memory region for %ld bytes (File %s, line %i)",
sz, file, line);
}
- } else {
- DEBUG(ctx, 40, "Allocated %ld bytes of memory on address %p (File %s, line %i)",
- sz, buf, file, line);
}
+#ifdef DEBUG
+ else {
+ // Don't use DEBUG macro, to catch the right file and line number for the log
+ _eurephia_log_func(ctx, LOG_DEBUG, 40, file, line,
+ "Allocated %ld bytes of memory on address %p",
+ sz, buf);
+ }
+#endif
return buf;
}
@@ -93,6 +98,9 @@ void inline _free_nullsafe(eurephiaCTX *ctx, void *ptr, const char *file, int li
if( ptr == NULL ) {
return;
}
- DEBUG(ctx, 40, "Freeing memory on address %p (File %s, line %i)", ptr, file, line);
+#ifdef DEBUG
+ // Don't use DEBUG macro, to catch the right file and line number for the log
+ _eurephia_log_func(ctx, LOG_DEBUG, 40, file, line, "Freeing memory on address %p", ptr);
+#endif
free(ptr);
}