mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
UserspaceEmulator: Use for_each_region_of_type
in find_text_region
Since we now have this helper template, we can make our code cleaner.
This commit is contained in:
parent
c1d6637dc7
commit
e9dd9d1f2c
Notes:
sideshowbarker
2024-07-18 07:16:22 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/e9dd9d1f2c2 Pull-request: https://github.com/SerenityOS/serenity/pull/8718 Issue: https://github.com/SerenityOS/serenity/issues/363 Reviewed-by: https://github.com/gunnarbeutner ✅ Reviewed-by: https://github.com/nico
1 changed files with 3 additions and 6 deletions
|
@ -378,13 +378,10 @@ Vector<FlatPtr> Emulator::raw_backtrace()
|
|||
MmapRegion const* Emulator::find_text_region(FlatPtr address)
|
||||
{
|
||||
MmapRegion const* matching_region = nullptr;
|
||||
mmu().for_each_region([&](auto& region) {
|
||||
if (!is<MmapRegion>(region))
|
||||
mmu().for_each_region_of_type<MmapRegion>([&](auto& region) {
|
||||
if (!(region.is_executable() && address >= region.base() && address < region.base() + region.size()))
|
||||
return IterationDecision::Continue;
|
||||
auto const& mmap_region = static_cast<MmapRegion const&>(region);
|
||||
if (!(mmap_region.is_executable() && address >= mmap_region.base() && address < mmap_region.base() + mmap_region.size()))
|
||||
return IterationDecision::Continue;
|
||||
matching_region = &mmap_region;
|
||||
matching_region = ®ion;
|
||||
return IterationDecision::Break;
|
||||
});
|
||||
return matching_region;
|
||||
|
|
Loading…
Reference in a new issue