summaryrefslogtreecommitdiff
path: root/src/arena.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arena.c')
-rw-r--r--src/arena.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/arena.c b/src/arena.c
index 36a9ce7..62dbbf8 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -23,6 +23,7 @@ typedef struct arena {
23 arenanode *current; 23 arenanode *current;
24 24
25 // For keeping track of the largest possible thing that can be allocated to one node 25 // For keeping track of the largest possible thing that can be allocated to one node
26 // I don't know if I care to keep this or remove it. I'll see if it becomes a problem / is useful
26 size_t node_memspace; 27 size_t node_memspace;
27} arena; 28} arena;
28 29
@@ -49,7 +50,7 @@ arenanode * arenanode_init(size_t bytes) {
49 50
50arena * arena_init(size_t bytes) { 51arena * arena_init(size_t bytes) {
51 if(!ISPOWOF2(MEM_ALIGN_BYTES)) 52 if(!ISPOWOF2(MEM_ALIGN_BYTES))
52 XALLOC_EXIT("<arena_init> \"MEM_ALIGN_BYTES\" is not a power of 2. Refusing to create a new arena"); 53 XALLOC_EXIT("<arena_init> \"MEM_ALIGN_BYTES\" is not a power of 2. Refusing to create a new arena", );
53 54
54 arena *a = VALLOC(1, sizeof(arena)); 55 arena *a = VALLOC(1, sizeof(arena));
55 if(!a) 56 if(!a)
@@ -73,7 +74,7 @@ arena * arena_init(size_t bytes) {
73 74
74void * arena_alloc(arena * const arena, size_t bytes) { 75void * arena_alloc(arena * const arena, size_t bytes) {
75 if(!ISPOWOF2(MEM_ALIGN_BYTES)) 76 if(!ISPOWOF2(MEM_ALIGN_BYTES))
76 XALLOC_EXIT("<arena_alloc> \"MEM_ALIGN_BYTES\" is not a power of 2. Refusing to allocate any memory"); 77 XALLOC_EXIT("<arena_alloc> \"MEM_ALIGN_BYTES\" is not a power of 2. Refusing to allocate any memory", );
77 if(!arena) 78 if(!arena)
78 RETURNWERR(EINVAL, NULL); 79 RETURNWERR(EINVAL, NULL);
79 if(bytes > arena->node_memspace) 80 if(bytes > arena->node_memspace)