Files
mop3/libarena/arena.h
kamkow1 f846edf0ff
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m44s
Add arena allocator library
2026-02-25 18:20:59 +01:00

26 lines
446 B
C

#ifndef _LIBARENA_ARENA_H
#define _LIBARENA_ARENA_H
#include <stddef.h>
#define ARENA_CHUNK_CAPACITY (8 * 1024)
struct arena_chunk {
struct arena_chunk* next;
size_t capacity;
size_t size;
uintptr_t memory[];
};
struct arena {
struct arena_chunk *begin, *end;
};
void arena_reset (struct arena* arena);
void arena_destroy (struct arena* arena);
void* arena_malloc (struct arena* arena, size_t size);
#endif // _LIBARENA_ARENA_H