2024-01-19 19:41:13 +00:00
|
|
|
|
|
|
|
#ifndef RR_ARENA_ALLOCATOR_H
|
|
|
|
#define RR_ARENA_ALLOCATOR_H
|
|
|
|
|
|
|
|
#include <librr/types.h>
|
2024-01-19 21:05:57 +00:00
|
|
|
#include <librr/alloc/generic.h>
|
2024-01-19 19:41:13 +00:00
|
|
|
|
2024-01-23 17:49:20 +00:00
|
|
|
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);
|
2024-01-19 21:05:57 +00:00
|
|
|
void rr_destruct_arena(rr_generic_arena_s *generic_arena);
|
2024-01-19 19:41:13 +00:00
|
|
|
|
2024-01-19 21:05:57 +00:00
|
|
|
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);
|
2024-01-19 19:41:13 +00:00
|
|
|
|
|
|
|
#endif // RR_ARENA_ALLOCATOR_H
|