about summary refs log tree commit diff stats
path: root/inc/arena.h
blob: dda105b60811f7e188281a3dfb3b7130b3b2fcb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 */