#ifndef AMALGAM_ARENA_ALLOCATOR_H #define AMALGAM_ARENA_ALLOCATOR_H #include "defs.h" #include "misc.h" #include "types.h" #include "buffer.h" struct ArenaAllocatorNode { char *data; usize size; ArenaAllocatorNode *next; }; struct ArenaAllocator { ArenaAllocatorNode head; ArenaAllocatorNode *current; Buffer/**/ mems; }; CHECK_RESULT int arena_allocator_node_init(ArenaAllocatorNode *self); void arena_allocator_node_deinit(ArenaAllocatorNode *self); CHECK_RESULT int arena_allocator_init(ArenaAllocator *self); void arena_allocator_deinit(ArenaAllocator *self); CHECK_RESULT int arena_allocator_alloc(ArenaAllocator *self, usize size, void **mem); CHECK_RESULT int arena_allocator_add_mem(ArenaAllocator *self, usize *result_index); #endif