lib: heap: Fixed compilation warning related to unused variable.
Reorganized the code to avoid compilation warning.
Change-Id: I05f019e089dc6671de6a0b2d8d6db8c631cfaa55
diff --git a/lib/heap/heap.c b/lib/heap/heap.c
index a4835f9..2f41f6c 100644
--- a/lib/heap/heap.c
+++ b/lib/heap/heap.c
@@ -156,19 +156,19 @@
// nearby ones if possible. Returns base of whatever chunk it became in the list.
static struct free_heap_chunk *heap_insert_free_chunk(struct free_heap_chunk *chunk)
{
-#if DEBUGLEVEL > INFO
+#if DEBUG_HEAP
vaddr_t chunk_end = (vaddr_t)chunk + chunk->len;
+ dprintf(CRITICAL,"%s: chunk ptr %p, size 0x%lx, chunk_end 0x%x\n",
+ __FUNCTION__, chunk, chunk->len, chunk_end);
#endif
-// dprintf("%s: chunk ptr %p, size 0x%lx, chunk_end 0x%x\n", __FUNCTION__, chunk, chunk->len, chunk_end);
-
struct free_heap_chunk *next_chunk;
struct free_heap_chunk *last_chunk;
// walk through the list, finding the node to insert before
list_for_every_entry(&theheap.free_list, next_chunk, struct free_heap_chunk, node) {
if (chunk < next_chunk) {
- DEBUG_ASSERT(chunk_end <= (vaddr_t)next_chunk);
+ DEBUG_ASSERT(((vaddr_t)chunk + chunk->len) <= (vaddr_t)next_chunk);
list_add_before(&next_chunk->node, &chunk->node);