summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-16 11:22:46 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-16 11:22:46 +0200
commitcab7429706aa6fce9d217ba6c5e3b6e5557914d5 (patch)
tree5f718ffb09cabf720ea19fedccac9e3ba087f8e9 /utils.c
parent18a5dcf9ef6f9bde77326bb363ec61bbf6b5e587 (diff)
Cleanup debugging macros a bit
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/utils.c b/utils.c
index 56b75a5..20c4802 100644
--- a/utils.c
+++ b/utils.c
@@ -36,8 +36,9 @@ add_allocation(const char *allocfn, const char *callerfn, int line, void *ptr, s
{
struct allocation *a = malloc(sizeof(*a));
- fprintf(stderr, "Allocation: %s:%i %s(%zu) = %p\n",
- callerfn, line, allocfn, size, ptr);
+ debug(DBG_MALLOC, "%s:%i %s(%zu) = %p\n",
+ callerfn, line, allocfn, size, ptr);
+
a->allocfn = allocfn;
a->callerfn = callerfn;
a->line = line;
@@ -98,7 +99,8 @@ __xfree(const char *fn, int line, void *ptr)
free(ptr);
malloc_count--;
- fprintf(stderr, "Deallocation: %s:%i %p\n", fn, line, ptr);
+ debug(DBG_MALLOC, "%s:%i %p\n", fn, line, ptr);
+
list_for_each_entry_safe(a, tmp, &malloc_list, list) {
if (a->ptr == ptr) {
list_del(&a->list);