From 7d663615b2a44715e7447a40cae467d7d4e38b9c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 14 Sep 2019 00:52:24 +0200 Subject: Start on opengl test, fix stack alignment before call (sys-v) --- src/std/buffer.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/std/buffer.c') 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; } -- cgit v1.2.3