1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

LibDebug: Dont copy an AbbreviationEntry every time we retrieve a value

These API's are used in a variety of ways when building the die cache.
Each AbbreviationEntry has vector and other members, so avoid copying
it at all costs.
This commit is contained in:
Brian Gianforcaro 2021-09-17 02:22:34 -07:00 committed by Andreas Kling
parent 952441943f
commit c5cdb6eb4c
3 changed files with 13 additions and 11 deletions

View file

@ -66,9 +66,13 @@ void AbbreviationsMap::populate_map()
}
}
Optional<AbbreviationsMap::AbbreviationEntry> AbbreviationsMap::get(u32 code) const
AbbreviationsMap::AbbreviationEntry const* AbbreviationsMap::get(u32 code) const
{
return m_entries.get(code);
auto it = m_entries.find(code);
if (it == m_entries.end()) {
return nullptr;
}
return &it->value;
}
}