summaryrefslogtreecommitdiffstats
path: root/common/eurephia_nullsafe.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-09-28 22:47:42 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-09-28 22:47:42 +0200
commitf4980c7d59fa1e01ca4a5b5f65c9514ca18d3a88 (patch)
treeabbf368c53ce9e69c5188c731912325ceb86a13f /common/eurephia_nullsafe.c
parent9a024f7f1addcb6bfccc49e74250009d7dfa31ae (diff)
parent5aed7f6775777b2a6166d6eddffaa976eb4fac8b (diff)
downloadeurephia-f4980c7d59fa1e01ca4a5b5f65c9514ca18d3a88.tar.gz
eurephia-f4980c7d59fa1e01ca4a5b5f65c9514ca18d3a88.tar.xz
eurephia-f4980c7d59fa1e01ca4a5b5f65c9514ca18d3a88.zip
Merge branch 'syslog'
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);
}