From ad2551e6b8369c3ca9c16f79da1d6f03dd519745 Mon Sep 17 00:00:00 2001 From: Maciej Date: Tue, 4 Jan 2022 17:08:29 +0100 Subject: [PATCH] AK: Add ByteBuffer::append(char) --- AK/ByteBuffer.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index ce160e32a3..106f650841 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -182,6 +182,11 @@ public: return try_ensure_capacity_slowpath(new_capacity); } + void append(char byte) + { + MUST(try_append(byte)); + } + void append(ReadonlyBytes bytes) { MUST(try_append(bytes)); @@ -189,6 +194,11 @@ public: void append(void const* data, size_t data_size) { append({ data, data_size }); } + ErrorOr try_append(char byte) + { + return try_append(&byte, 1); + } + ErrorOr try_append(ReadonlyBytes bytes) { return try_append(bytes.data(), bytes.size());