Base/platform/inc-c/alloc/arena.h

25 lines
610 B
C
Raw Normal View History

#ifndef RR_ARENA_ALLOCATOR_H
#define RR_ARENA_ALLOCATOR_H
#include <librr/types.h>
#include <librr/alloc/generic.h>
typedef struct rr_arena rr_arena_s;
struct rr_arena
{
usz_t capacity;
usz_t offset;
char *allocation;
rr_generic_allocator_s *allocator;
};
rr_generic_arena_s rr_new_arena(rr_generic_allocator_s *allocator, usz_t capacity);
void rr_destruct_arena(rr_generic_arena_s *generic_arena);
void * rr_arena_alloc(rr_generic_arena_s *generic_arena, usz_t length);
char * rr_arena_clone_string(rr_generic_arena_s *generic_arena, const char *string);
#endif // RR_ARENA_ALLOCATOR_H