From cdab3dea9055f7cb560480cd25f70bad3d7c42ee Mon Sep 17 00:00:00 2001 From: apio Date: Thu, 7 Mar 2024 23:10:35 +0100 Subject: [PATCH] libluna: Assert some unreachable conditions --- libluna/src/Heap.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/libluna/src/Heap.cpp b/libluna/src/Heap.cpp index 7f808303..44783998 100644 --- a/libluna/src/Heap.cpp +++ b/libluna/src/Heap.cpp @@ -166,12 +166,7 @@ static Result combine_forward(HeapBlock* block) if (next->status & BLOCK_END_MEM) { - if (next->status & BLOCK_START_MEM) - { - const usize pages = ceil_div(next->full_size + sizeof(HeapBlock), PAGE_SIZE); - TRY(release_pages_impl(next, pages)); - return {}; - } + if (next->status & BLOCK_START_MEM) { unreachable(); } else block->status |= BLOCK_END_MEM; } @@ -195,12 +190,7 @@ static Result combine_backward(HeapBlock* block) if (block->status & BLOCK_END_MEM) { - if (block->status & BLOCK_START_MEM) - { - const usize pages = ceil_div(block->full_size + sizeof(HeapBlock), PAGE_SIZE); - TRY(release_pages_impl(block, pages)); - return last; - } + if (block->status & BLOCK_START_MEM) { unreachable(); } else last->status |= BLOCK_END_MEM; }