small buffer resizing improvement from Morten Welinder closes #140629
* tree.c: small buffer resizing improvement from Morten Welinder
closes #140629
Daniel
diff --git a/tree.c b/tree.c
index 8e9cbf6..08ac731 100644
--- a/tree.c
+++ b/tree.c
@@ -6700,9 +6700,6 @@
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
- /*take care of empty case*/
- newSize = (buf->size ? buf->size*2 : size);
-
/* Don't resize if we don't have to */
if (size < buf->size)
return 1;
@@ -6710,6 +6707,8 @@
/* figure out new size */
switch (buf->alloc){
case XML_BUFFER_ALLOC_DOUBLEIT:
+ /*take care of empty case*/
+ newSize = (buf->size ? buf->size*2 : size + 10);
while (size > newSize) newSize *= 2;
break;
case XML_BUFFER_ALLOC_EXACT: