1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:28:11 +00:00

AK: Make HashTable and HashMap try_* functions return ErrorOr<T>

This allows us to use TRY() and MUST() with them.
This commit is contained in:
Andreas Kling 2021-11-10 23:00:21 +01:00
parent 4eaa95769d
commit 9d1f238450
3 changed files with 22 additions and 37 deletions

View file

@ -315,10 +315,7 @@ void PerformanceEventBuffer::add_process(const Process& process, ProcessEventTyp
ErrorOr<FlatPtr> PerformanceEventBuffer::register_string(NonnullOwnPtr<KString> string)
{
FlatPtr string_id = m_strings.size();
if (m_strings.try_set(move(string)) == AK::HashSetResult::Failed)
return ENOBUFS;
TRY(m_strings.try_set(move(string)));
return string_id;
}