From 2de582afc4d5ecf1c5632203590c737af553eea2 Mon Sep 17 00:00:00 2001 From: implicitfield <114500360+implicitfield@users.noreply.github.com> Date: Sat, 18 Nov 2023 10:53:53 +0400 Subject: [PATCH] AK: Make ByteBuffer's trim helper public --- AK/ByteBuffer.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index 947f883d36e..316c113709e 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -168,6 +168,14 @@ public: MUST(try_resize(new_size)); } + void trim(size_t size, bool may_discard_existing_data) + { + VERIFY(size <= m_size); + if (!m_inline && size <= inline_capacity) + shrink_into_inline_buffer(size, may_discard_existing_data); + m_size = size; + } + ALWAYS_INLINE void ensure_capacity(size_t new_capacity) { MUST(try_ensure_capacity(new_capacity)); @@ -282,14 +290,6 @@ private: other.m_inline = true; } - void trim(size_t size, bool may_discard_existing_data) - { - VERIFY(size <= m_size); - if (!m_inline && size <= inline_capacity) - shrink_into_inline_buffer(size, may_discard_existing_data); - m_size = size; - } - NEVER_INLINE void shrink_into_inline_buffer(size_t size, bool may_discard_existing_data) { // m_inline_buffer and m_outline_buffer are part of a union, so save the pointer