#ifndef _LIBARENA_ARENA_H
#define _LIBARENA_ARENA_H

#include <stddef.h>
#include <stdint.h>

#define ARENA_CHUNK_CAPACITY (1024 * 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);

void* arena_realloc (struct arena* arena, void* memory, size_t prev_size, size_t new_size);

#endif // _LIBARENA_ARENA_H
