diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-16 11:22:46 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-16 11:22:46 +0200 |
commit | cab7429706aa6fce9d217ba6c5e3b6e5557914d5 (patch) | |
tree | 5f718ffb09cabf720ea19fedccac9e3ba087f8e9 /utils.c | |
parent | 18a5dcf9ef6f9bde77326bb363ec61bbf6b5e587 (diff) |
Cleanup debugging macros a bit
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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); |