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

AK: Make ByteBuffer::try_* functions return ErrorOr<void>

Same as Vector, ByteBuffer now also signals allocation failure by
returning an ENOMEM Error instead of a bool, allowing us to use the
TRY() and MUST() patterns.
This commit is contained in:
Andreas Kling 2021-11-10 14:33:44 +01:00
parent 88b6428c25
commit a15ed8743d
20 changed files with 59 additions and 70 deletions

View file

@ -273,8 +273,8 @@ bool Parser::initialize_hint_tables()
if (!buffer_result.has_value())
return false;
possible_merged_stream_buffer = buffer_result.release_value();
auto ok = possible_merged_stream_buffer.try_append(primary_hint_stream->bytes());
ok = ok && possible_merged_stream_buffer.try_append(overflow_hint_stream->bytes());
auto ok = !possible_merged_stream_buffer.try_append(primary_hint_stream->bytes()).is_error();
ok = ok && !possible_merged_stream_buffer.try_append(overflow_hint_stream->bytes()).is_error();
if (!ok)
return false;
hint_stream_bytes = possible_merged_stream_buffer.bytes();