AK: Make ByteBuffer::slice(0, size()) a freebie

If you want the whole buffer, we can just give you the buffer itself.
This commit is contained in:
Andreas Kling 2021-03-15 15:46:54 +01:00
parent 3a5a9a683f
commit 64cb04996f
Notes: sideshowbarker 2024-07-18 21:20:06 +09:00

View file

@ -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());