diff options
Diffstat (limited to 'src/std')
-rw-r--r-- | src/std/buffer.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/std/buffer.c b/src/std/buffer.c index b0099bb..0936573 100644 --- a/src/std/buffer.c +++ b/src/std/buffer.c @@ -12,6 +12,7 @@ void tsl_buffer_init(TslBuffer *self) { void tsl_buffer_deinit(TslBuffer *self) { free(self->data); + self->data = NULL; self->size = 0; self->capacity = 0; } @@ -26,7 +27,7 @@ static int tsl_buffer_ensure_capacity(TslBuffer *self, size_t new_size) { new_capacity = 8; while(new_capacity < new_size) { - new_capacity <<= 1; + new_capacity += (new_capacity >> 1); } new_ptr = realloc(self->data, new_capacity); @@ -54,11 +55,6 @@ void* tsl_buffer_pop(TslBuffer *self, size_t size) { return (char*)self->data + self->size; } -void* tsl_buffer_top(TslBuffer *self, size_t data_size) { - tsl_buffer_pop(self, data_size); - return (char*)self->data + self->size; -} - void* tsl_buffer_begin(TslBuffer *self) { return self->data; } |