Update comment

This commit is contained in:
Patrick Pelissier committed 2019-04-20 12:33:08 +02:00
1 parent 277d8b37af
commit 00f1b1fc4f
1 file changed
+2 -1
+2 -1
View File
@@ -196,7 +196,7 @@ stringi_fit2size (string_t v, size_t size_alloc)
// Note: this function may be called in context where the contract
// is not fullfilled.
const size_t old_alloc = string_capacity(v);
if (size_alloc > old_alloc) {
if (M_UNLIKELY (size_alloc > old_alloc)) {
size_t alloc = size_alloc + size_alloc / 2;
if (M_UNLIKELY (alloc <= old_alloc)) {
/* Overflow in alloc computation */
@@ -215,6 +215,7 @@ stringi_fit2size (string_t v, size_t size_alloc)
return;
}
if (string_int_stack_p(v)) {
/* Copy the stack allocation into the heap allocation */
memcpy(ptr, &v->u.stack.buffer[1], v->u.stack.buffer[0]+1);
}
v->ptr = ptr;