Add temp arena support
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "mem_arena.h"
|
||||
#include "../../mem/mem_os.h"
|
||||
#include "../../../common/aliases/aliases.h"
|
||||
#include "../../../common/assert/assert.h"
|
||||
|
||||
wapp_intern void initialise_arena_allocator(Allocator *allocator);
|
||||
wapp_intern void *mem_arena_alloc(u64 size, void *alloc_obj);
|
||||
@@ -36,11 +37,23 @@ Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags
|
||||
return allocator;
|
||||
}
|
||||
|
||||
void wapp_mem_arena_allocator_temp_begin(const Allocator *allocator) {
|
||||
wapp_debug_assert(allocator != NULL, "`allocator` should not be NULL");
|
||||
wapp_mem_arena_temp_begin((Arena *)(allocator->obj));
|
||||
}
|
||||
|
||||
void wapp_mem_arena_allocator_temp_end(const Allocator *allocator) {
|
||||
wapp_debug_assert(allocator != NULL, "`allocator` should not be NULL");
|
||||
wapp_mem_arena_temp_end((Arena *)(allocator->obj));
|
||||
}
|
||||
|
||||
void wapp_mem_arena_allocator_clear(Allocator *allocator) {
|
||||
wapp_debug_assert(allocator != NULL, "`allocator` should not be NULL");
|
||||
wapp_mem_arena_clear((Arena *)(allocator->obj));
|
||||
}
|
||||
|
||||
void wapp_mem_arena_allocator_destroy(Allocator *allocator) {
|
||||
wapp_debug_assert(allocator != NULL, "`allocator` should not be NULL");
|
||||
wapp_mem_arena_destroy((Arena **)(&(allocator->obj)));
|
||||
*allocator = (Allocator){0};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user