diff options
Diffstat (limited to 'src/std')
-rw-r--r-- | src/std/buffer.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/std/buffer.c b/src/std/buffer.c index dd7d0f6..343173a 100644 --- a/src/std/buffer.c +++ b/src/std/buffer.c @@ -12,6 +12,8 @@ void tsl_buffer_init(TslBuffer *self) { void tsl_buffer_deinit(TslBuffer *self) { free(self->data); + self->size = 0; + self->capacity = 0; } static int tsl_buffer_ensure_capacity(TslBuffer *self, size_t new_size) { @@ -57,3 +59,12 @@ void* tsl_buffer_begin(TslBuffer *self) { void* tsl_buffer_end(TslBuffer *self) { return (char*)self->data + self->size; } + +void tsl_buffer_move(TslBuffer *dst, TslBuffer *src) { + dst->data = src->data; + dst->size = src->size; + dst->capacity = src->capacity; + src->data = NULL; + src->size = 0; + src->capacity = 0; +} |