diff options
Diffstat (limited to 'src/std/mem.h')
-rw-r--r-- | src/std/mem.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/std/mem.h b/src/std/mem.h index 74222a7..c3ec61d 100644 --- a/src/std/mem.h +++ b/src/std/mem.h @@ -9,6 +9,17 @@ */ #pragma once -#include "defines.h" +#include <stddef.h> -typedef void* (*alloc)(size_t amount);
\ No newline at end of file +// Inspired by https://nullprogram.com/blog/2023/09/27/ +typedef struct arena { + char* begin; + char* curr; + char* end; +} arena; + +arena arena_create(void* backing_buffer, size_t capacity); +void* arena_alloc(arena* a, size_t size); +void* arena_alloc_align(arena* a, size_t size, size_t align); +void arena_free_all(arena* a); +// TODO: arena_resize
\ No newline at end of file |