mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:34:57 +00:00
AK: Replace ByteBuffer::grow with resize()/ensure_capacity()
Previously ByteBuffer::grow() behaved like Vector<T>::resize(). However the function name was somewhat ambiguous - and so this patch updates ByteBuffer to behave more like Vector<T> by replacing grow() with resize() and adding an ensure_capacity() method. This also lets the user change the buffer's capacity without affecting the size which was not previously possible. Additionally this patch makes the capacity() method public (again).
This commit is contained in:
parent
dc54a0fbd3
commit
5f18cf75c5
7 changed files with 41 additions and 32 deletions
|
@ -26,7 +26,7 @@ inline void StringBuilder::will_append(size_t size)
|
|||
if (needed_capacity > inline_capacity)
|
||||
expanded_capacity *= 2;
|
||||
VERIFY(!expanded_capacity.has_overflow());
|
||||
m_buffer.grow(expanded_capacity.value());
|
||||
m_buffer.resize(expanded_capacity.value());
|
||||
}
|
||||
|
||||
StringBuilder::StringBuilder(size_t initial_capacity)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue