From ffc46e5f3d3b8bfcf5aaa0832dcd944bbf415e9b Mon Sep 17 00:00:00 2001 From: Nicole Kleinhoff Date: Tue, 23 Feb 2021 00:34:16 +0000 Subject: [PATCH] core/heap.disabled: rip out HEAP_DEBUG code There's little point in basically just reporting the equivalent of malloc()/free() each time it happens; there isn't really anything to debug here. This also fixes a bug introduced in 101e46d8ac; the HEAP_DEBUG code had not been properly adjusted and still referenced a variable removed in that commit, thus breaking compilation with HEAP_DEBUG enabled. --- src/libmowgli/core/heap.disabled.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/libmowgli/core/heap.disabled.c b/src/libmowgli/core/heap.disabled.c index 14b39f9..83bd5f8 100644 --- a/src/libmowgli/core/heap.disabled.c +++ b/src/libmowgli/core/heap.disabled.c @@ -47,22 +47,13 @@ mowgli_heap_create_full(const size_t elem_size, mowgli_heap_t *const heap = allocator->allocate(sizeof *heap); if (! heap) - { -#ifdef HEAP_DEBUG - (void) mowgli_log_warning("cannot allocate memory for heap"); -#endif return NULL; - } (void) memset(heap, 0x00, sizeof *heap); heap->allocator = allocator; heap->elem_size = elem_size; -#ifdef HEAP_DEBUG - (void) mowgli_log("pseudoheap@%p: created (elem_size %zu)", heap, elem_size); -#endif - return heap; } @@ -84,10 +75,6 @@ mowgli_heap_destroy(mowgli_heap_t *const restrict heap) return_if_fail(heap->allocator->deallocate != NULL); (void) heap->allocator->deallocate(heap); - -#ifdef HEAP_DEBUG - (void) mowgli_log("pseudoheap@%p: destroyed (elem_size %zu)", heap, elem_size); -#endif } void * @@ -101,16 +88,7 @@ mowgli_heap_alloc(mowgli_heap_t *const restrict heap) void *ptr = heap->allocator->allocate(heap->elem_size); if (!ptr) - { -#ifdef HEAP_DEBUG - (void) mowgli_log_warning("pseudoheap@%p: cannot allocate memory for ptr", heap); -#endif return NULL; - } - -#ifdef HEAP_DEBUG - (void) mowgli_log("pseudoheap@%p: allocated ptr %p (elem_size %zu)", heap, block->ptr, heap->elem_size); -#endif return memset(ptr, 0x00, heap->elem_size); } @@ -123,10 +101,5 @@ mowgli_heap_free(mowgli_heap_t *const restrict heap, void *const restrict ptr) return_if_fail(heap->allocator->deallocate != NULL); return_if_fail(ptr != NULL); -#ifdef HEAP_DEBUG - (void) mowgli_log("pseudoheap@%p: freeing ptr %p (elem_size %zu)", - heap, ptr, heap->elem_size); -#endif - (void) heap->allocator->deallocate(ptr); }