Convert MemoryMapIterator to Option
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a32590ff8a
commit
2e24e09146
@ -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++);
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user