]> jfr.im git - irc/atheme/libmowgli-2.git/commitdiff
core/heap.disabled: rip out HEAP_DEBUG code
authorNicole Kleinhoff <redacted>
Tue, 23 Feb 2021 00:34:16 +0000 (00:34 +0000)
committerNicole Kleinhoff <redacted>
Tue, 23 Feb 2021 00:34:16 +0000 (00:34 +0000)
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

index 14b39f9e31648d0c65f98febd1be03172a39afe1..83bd5f8be6b577f5afae0d5c90cae71389353a73 100644 (file)
@@ -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);
 }