mirror of
https://github.com/akheron/jansson.git
synced 2025-04-06 05:55:05 +00:00
strbuffer: Allocate enough space for value initially
This commit is contained in:
parent
197d3aa160
commit
3e0134782b
1 changed files with 1 additions and 1 deletions
|
@ -42,7 +42,7 @@ int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, int size)
|
|||
if(strbuff->length + size > strbuff->size)
|
||||
{
|
||||
if(strbuff->length == 0)
|
||||
strbuff->size = STRBUFFER_MIN_SIZE;
|
||||
strbuff->size = max(size + 1, STRBUFFER_MIN_SIZE);
|
||||
else
|
||||
strbuff->size = max(strbuff->size * STRBUFFER_FACTOR,
|
||||
strbuff->length + size + 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue