projects
/
jansson.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
197d3aa
)
strbuffer: Allocate enough space for value initially
author
Petri Lehtinen
<petri@digip.org>
Sat, 13 Jun 2009 19:26:23 +0000
(22:26 +0300)
committer
Petri Lehtinen
<petri@digip.org>
Sat, 13 Jun 2009 19:26:23 +0000
(22:26 +0300)
src/strbuffer.c
patch
|
blob
|
history
diff --git
a/src/strbuffer.c
b/src/strbuffer.c
index
ea74b6d
..
2445a75
100644
(file)
--- a/
src/strbuffer.c
+++ b/
src/strbuffer.c
@@
-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);