mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05:00
Kernel: Fetch range once for each iteration of find_regions_intersecting
pvs-studio flagged this as a potential optimization.
This commit is contained in:
parent
e8ec1e908d
commit
24207d3795
1 changed files with 3 additions and 2 deletions
|
@ -251,10 +251,11 @@ Vector<Region*> AddressSpace::find_regions_intersecting(VirtualRange const& rang
|
|||
if (!found_region)
|
||||
return regions;
|
||||
for (auto iter = m_regions.begin_from((*found_region)->vaddr().get()); !iter.is_end(); ++iter) {
|
||||
if ((*iter)->range().base() < range.end() && (*iter)->range().end() > range.base()) {
|
||||
const auto& iter_range = (*iter)->range();
|
||||
if (iter_range.base() < range.end() && iter_range.end() > range.base()) {
|
||||
regions.append(*iter);
|
||||
|
||||
total_size_collected += (*iter)->size() - (*iter)->range().intersect(range).size();
|
||||
total_size_collected += (*iter)->size() - iter_range.intersect(range).size();
|
||||
if (total_size_collected == range.size())
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue