mirror of
https://github.com/RGBCube/serenity
synced 2025-07-31 15:37:47 +00:00
AK: Remove infallible version of StringBuilder::to_byte_buffer
Also drop the try_ prefix from the fallible function, as it is no longer needed to distinguish the two.
This commit is contained in:
parent
ad5e8f2742
commit
e76394d96c
13 changed files with 21 additions and 28 deletions
|
@ -105,15 +105,9 @@ void StringBuilder::append_repeated(char ch, size_t n)
|
|||
MUST(try_append_repeated(ch, n));
|
||||
}
|
||||
|
||||
ByteBuffer StringBuilder::to_byte_buffer() const
|
||||
ErrorOr<ByteBuffer> StringBuilder::to_byte_buffer() const
|
||||
{
|
||||
// FIXME: Handle OOM failure.
|
||||
return ByteBuffer::copy(data(), length()).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
ErrorOr<ByteBuffer> StringBuilder::try_to_byte_buffer() const
|
||||
{
|
||||
return TRY(ByteBuffer::copy(data(), length()));
|
||||
return ByteBuffer::copy(data(), length());
|
||||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
|
|
|
@ -68,8 +68,7 @@ public:
|
|||
ErrorOr<String> to_string() const;
|
||||
ErrorOr<FlyString> to_fly_string() const;
|
||||
|
||||
[[nodiscard]] ByteBuffer to_byte_buffer() const;
|
||||
[[nodiscard]] ErrorOr<ByteBuffer> try_to_byte_buffer() const;
|
||||
[[nodiscard]] ErrorOr<ByteBuffer> to_byte_buffer() const;
|
||||
|
||||
[[nodiscard]] StringView string_view() const;
|
||||
void clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue