From 7e62ee66be6ff0b273db304d190920377abd076a Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 26 Dec 2022 12:24:39 +0100 Subject: [PATCH] Change heap.first().has_value() to the cheaper heap.count() --- kernel/src/memory/Heap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/src/memory/Heap.cpp b/kernel/src/memory/Heap.cpp index ec590d74..fa663dce 100644 --- a/kernel/src/memory/Heap.cpp +++ b/kernel/src/memory/Heap.cpp @@ -175,7 +175,7 @@ Result kmalloc(usize size, bool should_scrub) size = align_up<16>(size); - if (!heap.first().has_value()) + if (heap.count() == 0) { const usize pages = get_pages_for_allocation(size + sizeof(HeapBlock)); HeapBlock* const block = TRY(allocate_pages(pages));