mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:57:44 +00:00
LibDebug: Use HashMap::ensure() in DebugInfo::prepare_lines()
This commit is contained in:
parent
500067d3a6
commit
e40e91b9df
1 changed files with 3 additions and 7 deletions
|
@ -99,14 +99,10 @@ void DebugInfo::prepare_lines()
|
||||||
m_sorted_lines.ensure_capacity(all_lines.size());
|
m_sorted_lines.ensure_capacity(all_lines.size());
|
||||||
|
|
||||||
for (auto const& line_info : all_lines) {
|
for (auto const& line_info : all_lines) {
|
||||||
auto it = memoized_full_paths.find(line_info.file);
|
auto maybe_full_path = memoized_full_paths.ensure(line_info.file, [&] { return compute_full_path(line_info.file); });
|
||||||
if (it == memoized_full_paths.end()) {
|
if (!maybe_full_path.has_value())
|
||||||
memoized_full_paths.set(line_info.file, compute_full_path(line_info.file));
|
|
||||||
it = memoized_full_paths.find(line_info.file);
|
|
||||||
}
|
|
||||||
if (!it->value.has_value())
|
|
||||||
continue;
|
continue;
|
||||||
m_sorted_lines.unchecked_append({ line_info.address, it->value.value(), line_info.line });
|
m_sorted_lines.unchecked_append({ line_info.address, maybe_full_path.release_value(), line_info.line });
|
||||||
}
|
}
|
||||||
|
|
||||||
quick_sort(m_sorted_lines, [](auto& a, auto& b) {
|
quick_sort(m_sorted_lines, [](auto& a, auto& b) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue