diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/serd_internal.h | 2 | ||||
-rw-r--r-- | src/writer.c | 2 |
3 files changed, 4 insertions, 3 deletions
@@ -2,9 +2,10 @@ serd (0.29.3) unstable; * Support strict parsing of prefixed names * Report errors for all failing test cases + * Use more efficient stack allocation and growth policies * Fix building with MSVC - -- David Robillard <d@drobilla.net> Sat, 23 Sep 2017 14:41:49 +0200 + -- David Robillard <d@drobilla.net> Sat, 23 Sep 2017 14:53:55 +0200 serd (0.28.0) stable; diff --git a/src/serd_internal.h b/src/serd_internal.h index acd66803..6a2893fb 100644 --- a/src/serd_internal.h +++ b/src/serd_internal.h @@ -156,7 +156,7 @@ serd_stack_push(SerdStack* stack, size_t n_bytes) { const size_t new_size = stack->size + n_bytes; if (stack->buf_size < new_size) { - stack->buf_size *= 2; + stack->buf_size += (stack->buf_size >> 1); // *= 1.5 stack->buf = (uint8_t*)realloc(stack->buf, stack->buf_size); } uint8_t* const ret = (stack->buf + stack->size); diff --git a/src/writer.c b/src/writer.c index d1f1b87f..c21676b2 100644 --- a/src/writer.c +++ b/src/writer.c @@ -862,7 +862,7 @@ serd_writer_new(SerdSyntax syntax, writer->root_node = SERD_NODE_NULL; writer->root_uri = SERD_URI_NULL; writer->base_uri = base_uri ? *base_uri : SERD_URI_NULL; - writer->anon_stack = serd_stack_new(sizeof(WriteContext)); + writer->anon_stack = serd_stack_new(4 * sizeof(WriteContext)); writer->context = context; writer->list_subj = SERD_NODE_NULL; writer->empty = true; |