aboutsummaryrefslogtreecommitdiff
path: root/src/std/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/std/buffer.c')
-rw-r--r--src/std/buffer.c8
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;
}