Merge pull request #105278 from Ivorforce/reserve-smoke-test
Smoke test: Log an error if `reserve()` is called with fewer elements than `size()`
This commit is contained in:
commit
931820d33c
7 changed files with 16 additions and 13 deletions
|
|
@ -117,7 +117,8 @@ StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::append(const c
|
|||
|
||||
template <int SHORT_BUFFER_SIZE>
|
||||
StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::reserve(int p_size) {
|
||||
if (p_size < SHORT_BUFFER_SIZE || p_size < buffer.size() || !p_size) {
|
||||
ERR_FAIL_COND_V_MSG(p_size < length(), *this, "reserve() called with a capacity smaller than the current size. This is likely a mistake.");
|
||||
if (p_size <= SHORT_BUFFER_SIZE || p_size <= buffer.size()) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue