Rename array alloc size utility
This commit is contained in:
@@ -200,7 +200,7 @@ void _array_clear(GenericArray array, u64 item_size) {
|
||||
header->count = 0;
|
||||
}
|
||||
|
||||
u64 _array_alloc_size(u64 capacity, u64 item_size) {
|
||||
u64 _array_calc_alloc_size(u64 capacity, u64 item_size) {
|
||||
return sizeof(ArrayHeader) + item_size * capacity;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ GenericArray _array_alloc_capacity(const Allocator *allocator, u64 capacity, u64
|
||||
|
||||
GenericArray output = NULL;
|
||||
|
||||
u64 allocation_size = _array_alloc_size(capacity, item_size);
|
||||
u64 allocation_size = _array_calc_alloc_size(capacity, item_size);
|
||||
ArrayHeader *header = wapp_mem_allocator_alloc(allocator, allocation_size);
|
||||
if (!header) {
|
||||
goto RETURN_ARRAY_ALLOC;
|
||||
|
||||
@@ -171,7 +171,7 @@ typedef enum {
|
||||
#define wapp_array_clear(TYPE, ARRAY) \
|
||||
(_array_clear((GenericArray)ARRAY, \
|
||||
sizeof(TYPE)))
|
||||
#define wapp_array_alloc_size(TYPE, CAPACITY) _array_alloc_size(CAPACITY, sizeof(TYPE))
|
||||
#define wapp_array_calc_alloc_size(TYPE, CAPACITY) _array_calc_alloc_size(CAPACITY, sizeof(TYPE))
|
||||
|
||||
typedef struct header ArrayHeader;
|
||||
struct header {
|
||||
@@ -195,7 +195,7 @@ GenericArray _array_extend_alloc(const Allocator *allocator, GenericArray dst, c
|
||||
GenericArray _array_copy_alloc(const Allocator *allocator, GenericArray dst, const GenericArray src, u64 item_size);
|
||||
void *_array_pop(GenericArray array, u64 item_size);
|
||||
void _array_clear(GenericArray array, u64 item_size);
|
||||
u64 _array_alloc_size(u64 capacity, u64 item_size);
|
||||
u64 _array_calc_alloc_size(u64 capacity, u64 item_size);
|
||||
GenericArray _array_alloc_capacity(const Allocator *allocator, u64 capacity, u64 item_size,
|
||||
ArrayInitFlags flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user