arena allocators are fully implemented

This commit is contained in:
2025-12-06 14:19:53 +01:00
parent b912759050
commit d6ad1c7602
5 changed files with 92 additions and 10 deletions
+4 -2
View File
@@ -92,14 +92,16 @@ typedef struct arena_allocator {
uint8_t *data;
} arena_allocator_t;
#define arena_allocator_value(INITIAL_CAPACITY) ((arena_allocator_t) { \
.allocator=borrow_allocator_create(), \
#define arena_allocator_value(BACKING_ALLOCATOR, INITIAL_CAPACITY) ((arena_allocator_t) { \
.allocator=BACKING_ALLOCATOR, \
.size=0, \
.capacity=INITIAL_CAPACITY, \
.data=NULL \
})
allocator_t allocator_from_arena(arena_allocator_t *this);
#define arena_allocator_create(BACKING_ALLOCATOR, INITIAL_CAPACITY) \
allocator_from_arena(&arena_allocator_value(BACKING_ALLOCATOR, INITIAL_CAPACITY))
// dynamic arrays //////////////////////////////////////////////////////////////