1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +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

@ -460,7 +460,7 @@ static bool fill_getserv_buffers(const char* line, ssize_t read)
break;
}
auto alias = split_line[i].to_byte_buffer();
if (!alias.try_append("\0", sizeof(char)))
if (alias.try_append("\0", sizeof(char)).is_error())
return false;
__getserv_alias_list_buffer.append(move(alias));
}
@ -630,7 +630,7 @@ static bool fill_getproto_buffers(const char* line, ssize_t read)
if (split_line[i].starts_with('#'))
break;
auto alias = split_line[i].to_byte_buffer();
if (!alias.try_append("\0", sizeof(char)))
if (alias.try_append("\0", sizeof(char)).is_error())
return false;
__getproto_alias_list_buffer.append(move(alias));
}