diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-09-14 00:52:24 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 7d663615b2a44715e7447a40cae467d7d4e38b9c (patch) | |
tree | 612e81f55ca73c3da868bd2ab6cd96ae6ac30a15 /src/std/buffer.c | |
parent | 7103d3a1df6c7fee6e8efbe3588204d1e869004e (diff) |
Start on opengl test, fix stack alignment before call (sys-v)
Diffstat (limited to 'src/std/buffer.c')
-rw-r--r-- | src/std/buffer.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/std/buffer.c b/src/std/buffer.c index 021fce8..dca3b26 100644 --- a/src/std/buffer.c +++ b/src/std/buffer.c @@ -28,7 +28,6 @@ void buffer_deinit(Buffer *self) { static CHECK_RESULT int buffer_ensure_capacity(Buffer *self, usize new_capacity) { usize capacity; void *new_mem; - int alloc_result; if(self->capacity >= new_capacity) return BUFFER_OK; @@ -45,15 +44,14 @@ static CHECK_RESULT int buffer_ensure_capacity(Buffer *self, usize new_capacity) capacity = cap; } - alloc_result = am_realloc(self->data, capacity, &new_mem); - if(alloc_result != ALLOC_OK) + if(am_realloc(self->data, capacity, &new_mem) != ALLOC_OK) return BUFFER_ALLOC_FAIL; self->data = new_mem; self->capacity = capacity; /* Update list of buffers in the allocator with the new address of the buffer data */ if(self->allocator) - am_memcpy(self->allocator->mems.data + sizeof(void*) * self->allocator_index, &self->data, sizeof(void*)); + am_memcpy(self->allocator->mems.data + self->allocator_index, &self->data, sizeof(void*)); return BUFFER_OK; } @@ -103,7 +101,7 @@ int buffer_set_capacity(Buffer *self, usize new_capacity) { self->size = self->capacity; /* Update list of buffers in the allocator with the new address of the buffer data */ if(self->allocator) - am_memcpy(self->allocator->mems.data + sizeof(void*) * self->allocator_index, &self->data, sizeof(void*)); + am_memcpy(self->allocator->mems.data + self->allocator_index, &self->data, sizeof(void*)); return BUFFER_OK; } |