From 64cb04996f31c5163a3376a6ab649df59816430c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 15 Mar 2021 15:46:54 +0100 Subject: [PATCH] AK: Make ByteBuffer::slice(0, size()) a freebie If you want the whole buffer, we can just give you the buffer itself. --- AK/ByteBuffer.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index ea498d9ce8..039935bc7e 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -214,6 +214,9 @@ public: if (is_null()) return {}; + if (offset == 0 && size == this->size()) + return *this; + // I cannot hand you a slice I don't have VERIFY(offset + size <= this->size());