mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
AK: Make Vector::try_* functions return ErrorOr<void>
Instead of signalling allocation failure with a bool return value (false), we now use ErrorOr<void> and return ENOMEM as appropriate. This allows us to use TRY() and MUST() with Vector. :^)
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 01:18:14 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/88b6428c25e
@@ -311,7 +311,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
auto previous_size = m_elements.size();
|
||||
if (!m_elements.try_resize(new_size))
|
||||
if (m_elements.try_resize(new_size).is_error())
|
||||
return false;
|
||||
for (size_t i = previous_size; i < m_elements.size(); ++i)
|
||||
m_elements[i] = fill_value;
|
||||
|
||||
Reference in New Issue
Block a user