mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +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:
parent
4eaa95769d
commit
9d1f238450
Notes:
sideshowbarker
2024-07-18 01:17:54 +09:00
Author: https://github.com/awesomekling
Commit: 9d1f238450
3 changed files with 22 additions and 37 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue