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
Notes: sideshowbarker 2024-07-18 01:17:54 +09:00
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;
}