new repo for codebase
This commit is contained in:
30
src/core/core_ctx.c
Normal file
30
src/core/core_ctx.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "core_ctx.h"
|
||||
#include "core_platform.h"
|
||||
|
||||
gb_thread thread_ctx_t *tcx;
|
||||
|
||||
fn void *ma_arena_alo_proc(alo_t alo, alokind_t kind, void *ptr, size_t size) {
|
||||
unused(ptr);
|
||||
if (kind == alokind_alloc) {
|
||||
return ma_push_size(alo.object, size);
|
||||
} else if (kind == alokind_dealloc) {
|
||||
return NULL;
|
||||
} else_is_invalid;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fn alo_t malo(ma_arena_t *arena) {
|
||||
return (alo_t){arena, ma_arena_alo_proc};
|
||||
}
|
||||
|
||||
fn alo_t malot(ma_temp_t temp) {
|
||||
return malo(temp.arena);
|
||||
}
|
||||
|
||||
fn void dealloc(alo_t alo, void *ptr) {
|
||||
alo.proc(alo, alokind_dealloc, ptr, 0);
|
||||
}
|
||||
|
||||
fn void *alloc_size(alo_t alo, size_t size) {
|
||||
return alo.proc(alo, alokind_alloc, NULL, size);
|
||||
}
|
||||
Reference in New Issue
Block a user