aboutsummaryrefslogtreecommitdiff
path: root/src/std
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-01-23 03:09:54 +0100
committerdec05eba <dec05eba@protonmail.com>2020-01-23 03:09:54 +0100
commitcc30a97ab90a8fa40707936d3d089d81c49559b6 (patch)
treec6544b785395cf12b8c9f4c65c3f8ebb9699232d /src/std
parentb7f056a73ad4053eb2284c54873dfb3888dcb430 (diff)
Add bytecode decoding.. starting on program execution now
Diffstat (limited to 'src/std')
-rw-r--r--src/std/buffer.c11
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;
+}