Convert MemoryMapIterator to Option
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2022-12-16 19:47:20 +01:00
parent a32590ff8a
commit 2e24e09146
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 5 additions and 5 deletions

View File

@ -35,13 +35,13 @@ void MemoryMapIterator::rewind()
m_cur_ent = 0; m_cur_ent = 0;
} }
Result<MemoryMapEntry> MemoryMapIterator::at(usize index) const Option<MemoryMapEntry> 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); return memory_map_entry_from_mmapent(m_base_ent + index);
} }
Result<MemoryMapEntry> MemoryMapIterator::next() Option<MemoryMapEntry> MemoryMapIterator::next()
{ {
return at(m_cur_ent++); return at(m_cur_ent++);
} }

View File

@ -44,13 +44,13 @@ class MemoryMapIterator
void rewind(); void rewind();
Result<MemoryMapEntry> next(); Option<MemoryMapEntry> next();
MemoryMapEntry largest_free(); MemoryMapEntry largest_free();
MemoryMapEntry highest(); MemoryMapEntry highest();
Result<MemoryMapEntry> at(usize index) const; Option<MemoryMapEntry> at(usize index) const;
usize entries() const usize entries() const
{ {