diff options
author | David Robillard <d@drobilla.net> | 2017-09-23 14:54:09 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-09-23 15:59:23 +0200 |
commit | 78f38288245ca4245110869ad2c40afde931a0db (patch) | |
tree | 7e16135998e92fdf4f0b2b3c955867a2e30d4ae5 /src/serd_internal.h | |
parent | f8c8f7e02605c10af0b6bc9f1261e893dc825e97 (diff) | |
download | serd-78f38288245ca4245110869ad2c40afde931a0db.tar.gz serd-78f38288245ca4245110869ad2c40afde931a0db.tar.bz2 serd-78f38288245ca4245110869ad2c40afde931a0db.zip |
Use more efficient stack allocation and growth policies
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r-- | src/serd_internal.h | 2 |
1 files changed, 1 insertions, 1 deletions
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); |