From da104c87cb07f6d2db0240d24a31600eeb204699 Mon Sep 17 00:00:00 2001 From: apio Date: Thu, 8 Dec 2022 16:09:12 +0100 Subject: [PATCH] Heap: Return Option in split() --- kernel/src/memory/Heap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/src/memory/Heap.cpp b/kernel/src/memory/Heap.cpp index f47fd530..10f558aa 100644 --- a/kernel/src/memory/Heap.cpp +++ b/kernel/src/memory/Heap.cpp @@ -94,14 +94,14 @@ static usize get_fair_offset_to_split_at(HeapBlock* block, usize min) return available + block->req_size; } -static Result split(HeapBlock* block, usize size) +static Option split(HeapBlock* block, usize size) { const usize available = space_available(block); // How much space can we steal from this block? const usize old_size = block->full_size; // Save the old value of this variable since we are going to use it after modifying it if (available < (size + sizeof(HeapBlock))) - return err(ENONE); // This block hasn't got enough free space to hold the requested size. + return {}; // This block hasn't got enough free space to hold the requested size. const usize offset = get_fair_offset_to_split_at(block, size + sizeof(HeapBlock)); block->full_size = offset; // shrink the old block to fit this offset