cleanup
This commit is contained in:
+2
-4
@@ -1,13 +1,11 @@
|
||||
#include "cig.h"
|
||||
|
||||
static void *buffer_allocator_alloc(buffer_allocator_t *this, size_t bytes) {
|
||||
size_t address_of_new_data = (size_t) &this->data[this->size];
|
||||
size_t offset = address_of_new_data % MAX_ALIGN;
|
||||
size_t new_size = this->size + offset + bytes;
|
||||
bytes = (bytes + MAX_ALIGN - 1) / MAX_ALIGN * MAX_ALIGN;
|
||||
size_t new_size = this->size + bytes;
|
||||
if (new_size > this->capacity) {
|
||||
return NULL;
|
||||
}
|
||||
this->size += offset;
|
||||
void *ptr = &this->data[this->size];
|
||||
this->size = new_size;
|
||||
return ptr;
|
||||
|
||||
Reference in New Issue
Block a user