ostream buffer growth was broken

It only grew by 3/2 of the needed size instead of the needed capacity,
which could be extremely slow when growing by a constant amount
many times.
This commit is contained in:
Mathias Agopian
2024-11-12 01:36:51 -08:00
committed by Mathias Agopian
parent 51392c77aa
commit 5dfd285105
2 changed files with 16 additions and 15 deletions

View File

@@ -95,11 +95,11 @@ protected:
size_t length() const noexcept;
private:
void reserve(size_t newSize) noexcept;
void reserve(size_t newCapacity) noexcept;
char* buffer = nullptr; // buffer address
char* curr = nullptr; // current pointer
size_t size = 0; // size remaining
size_t sizeRemaining = 0; // size remaining
size_t capacity = 0; // total capacity of the buffer
};