diff options
author | Imogen Thoms <[email protected]> | 2025-01-30 21:35:11 +0000 |
---|---|---|
committer | Ren Kararou <[email protected]> | 2025-01-30 15:40:27 -0600 |
commit | f6dda8af9998eba76ff377c91cb69593c086b8c0 (patch) | |
tree | e180556894730e4f82b79a8b345718af261d2faa /inc/arena.h | |
parent | 11ff7f4f76d6deb5afab072ded3e115b130069c8 (diff) | |
download | libspicy-f6dda8af9998eba76ff377c91cb69593c086b8c0.tar.gz libspicy-f6dda8af9998eba76ff377c91cb69593c086b8c0.tar.bz2 libspicy-f6dda8af9998eba76ff377c91cb69593c086b8c0.zip |
added mogi_arena allocator
Signed-off-by: Imogen Thoms <[email protected]>
Diffstat (limited to 'inc/arena.h')
-rw-r--r-- | inc/arena.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/inc/arena.h b/inc/arena.h new file mode 100644 index 0000000..dda105b --- /dev/null +++ b/inc/arena.h @@ -0,0 +1,24 @@ +/* + * arena.h + * arena allocator i wrote during a meeting in 30 mins + * imogen sorindeia thoms 2025 + * */ + +#ifndef MOGI_ARENA_H +#define MOGI_ARENA_H + +#include <stdlib.h> +#include <stdint.h> + +struct _mogi_arena_s { + char *buffer; + size_t posn; + size_t capacity; +}; +typedef struct _mogi_arena_s mogi_arena_t; + +mogi_arena_t mogi_arena_init(size_t size); +void mogi_arena_dispose(mogi_arena_t *a); +uintptr_t mogi_arena_allocate(mogi_arena_t *a, size_t size); + +#endif /* MOGI_ARENA_H */ |