From 2e24e091467c64a7b3720af34763469b5ff050d5 Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 16 Dec 2022 19:47:20 +0100 Subject: [PATCH] Convert MemoryMapIterator to Option --- kernel/src/memory/MemoryMap.cpp | 6 +++--- kernel/src/memory/MemoryMap.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/src/memory/MemoryMap.cpp b/kernel/src/memory/MemoryMap.cpp index cf83a67a..8743e83c 100644 --- a/kernel/src/memory/MemoryMap.cpp +++ b/kernel/src/memory/MemoryMap.cpp @@ -35,13 +35,13 @@ void MemoryMapIterator::rewind() m_cur_ent = 0; } -Result MemoryMapIterator::at(usize index) const +Option MemoryMapIterator::at(usize index) const { - if (index >= m_mmap_entries) return err(ERANGE); + if (index >= m_mmap_entries) return {}; return memory_map_entry_from_mmapent(m_base_ent + index); } -Result MemoryMapIterator::next() +Option MemoryMapIterator::next() { return at(m_cur_ent++); } diff --git a/kernel/src/memory/MemoryMap.h b/kernel/src/memory/MemoryMap.h index 4c53bde4..669b07aa 100644 --- a/kernel/src/memory/MemoryMap.h +++ b/kernel/src/memory/MemoryMap.h @@ -44,13 +44,13 @@ class MemoryMapIterator void rewind(); - Result next(); + Option next(); MemoryMapEntry largest_free(); MemoryMapEntry highest(); - Result at(usize index) const; + Option at(usize index) const; usize entries() const {