1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

AK: Remove the public ByteBuffer::trim method

This removes the public trim() method because it is no longer
necessary. Callers can instead use resize().
This commit is contained in:
Gunnar Beutner 2021-05-31 00:39:08 +02:00 committed by Ali Mohammad Pur
parent 5f18cf75c5
commit d8b5fa9dfe
3 changed files with 8 additions and 13 deletions

View file

@ -50,7 +50,7 @@ public:
{
if (this != &other) {
if (m_size > other.size())
internal_trim(other.size(), true);
trim(other.size(), true);
else
resize(other.size());
__builtin_memcpy(data(), other.data(), other.size());
@ -126,11 +126,6 @@ public:
[[nodiscard]] void* end_pointer() { return data() + m_size; }
[[nodiscard]] void const* end_pointer() const { return data() + m_size; }
void trim(size_t size)
{
internal_trim(size, false);
}
[[nodiscard]] ByteBuffer slice(size_t offset, size_t size) const
{
// I cannot hand you a slice I don't have
@ -151,7 +146,7 @@ public:
ALWAYS_INLINE void resize(size_t new_size)
{
if (new_size <= m_size) {
trim(new_size);
trim(new_size, false);
return;
}
ensure_capacity(new_size);
@ -217,7 +212,7 @@ private:
other.m_inline = true;
}
void internal_trim(size_t size, bool may_discard_existing_data)
void trim(size_t size, bool may_discard_existing_data)
{
VERIFY(size <= m_size);
if (!m_inline && size <= inline_capacity) {