mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:57:35 +00:00
Kernel: Use range-for with InlineLinkedList
This commit is contained in:
parent
028e834bb4
commit
9104d32341
6 changed files with 21 additions and 21 deletions
|
@ -110,12 +110,12 @@ void VMObject::for_each_region(Callback callback)
|
|||
{
|
||||
// FIXME: Figure out a better data structure so we don't have to walk every single region every time an inode changes.
|
||||
// Perhaps VMObject could have a Vector<Region*> with all of his mappers?
|
||||
for (auto* region = MM.m_user_regions.head(); region; region = region->next()) {
|
||||
if (®ion->vmo() == this)
|
||||
callback(*region);
|
||||
for (auto& region : MM.m_user_regions) {
|
||||
if (®ion.vmo() == this)
|
||||
callback(region);
|
||||
}
|
||||
for (auto* region = MM.m_kernel_regions.head(); region; region = region->next()) {
|
||||
if (®ion->vmo() == this)
|
||||
callback(*region);
|
||||
for (auto& region : MM.m_kernel_regions) {
|
||||
if (®ion.vmo() == this)
|
||||
callback(region);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,9 +246,9 @@ Region* MemoryManager::kernel_region_from_vaddr(VirtualAddress vaddr)
|
|||
{
|
||||
if (vaddr.get() < 0xc0000000)
|
||||
return nullptr;
|
||||
for (auto* region = MM.m_kernel_regions.head(); region; region = region->next()) {
|
||||
if (region->contains(vaddr))
|
||||
return region;
|
||||
for (auto& region : MM.m_kernel_regions) {
|
||||
if (region.contains(vaddr))
|
||||
return ®ion;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ public:
|
|||
template<typename Callback>
|
||||
static void for_each_vmobject(Callback callback)
|
||||
{
|
||||
for (auto* vmobject = MM.m_vmobjects.head(); vmobject; vmobject = vmobject->next()) {
|
||||
if (callback(*vmobject) == IterationDecision::Break)
|
||||
for (auto& vmobject : MM.m_vmobjects) {
|
||||
if (callback(vmobject) == IterationDecision::Break)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue