diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-01-31 08:02:09 +0100 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-01-31 08:02:09 +0100 |
| commit | 8a9e6b1bd3be1041792311a86d8aac68b659e891 (patch) | |
| tree | 2a62729da17b2e6669c3d71a162525ff37e42c6a /memory.h | |
feat: First version, failing json parse string
Diffstat (limited to 'memory.h')
| -rw-r--r-- | memory.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/memory.h b/memory.h new file mode 100644 index 0000000..e1c5fdd --- /dev/null +++ b/memory.h @@ -0,0 +1,15 @@ +#include <stddef.h> + +#ifndef MEMORY_H +#define MEMORY_H +typedef struct { + ptrdiff_t cap; + char *beg; + char *end; +} Arena; + +Arena Arena_new(ptrdiff_t cap); +#define new(a, T, n) (T *)alloc(a, n, sizeof(T), _Alignof(T)) +void *alloc(Arena *a, ptrdiff_t count, int size, int align); +int Arena_get_used(Arena a); +#endif |
