summaryrefslogtreecommitdiff
path: root/src/arena.c
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2025-04-04 20:16:27 -0500
committer@syxhe <https://t.me/syxhe>2025-04-04 20:16:27 -0500
commitcd307d16713f2552f8cf9c1116e860de3aa2cec6 (patch)
tree9f80d1ca479fd757246554b4034da69223513e01 /src/arena.c
parent31f211a5d0969b07e98414fb47a5b5945200ddb6 (diff)
Add some documentation to arena.h, fix simplearena_clear not being declared
Diffstat (limited to 'src/arena.c')
-rw-r--r--src/arena.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/arena.c b/src/arena.c
index de3523b..07c28dc 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -51,6 +51,8 @@ arenanode * arenanode_init(size_t bytes) {
51arena * arena_init(size_t bytes) { 51arena * arena_init(size_t bytes) {
52 if(!ISPOWOF2(MEM_ALIGN_BYTES)) 52 if(!ISPOWOF2(MEM_ALIGN_BYTES))
53 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", );
54 if(bytes < 1)
55 RETURNWERR(EINVAL, NULL);
54 56
55 arena *a = VALLOC(1, sizeof(arena)); 57 arena *a = VALLOC(1, sizeof(arena));
56 if(!a) 58 if(!a)
@@ -142,10 +144,6 @@ int arena_clear(arena **arena) {
142 144
143 145
144 146
145// Simple Arena is an arena that can't expand whenever allocating memory, meaning what you originally allocated is what you get
146
147typedef arena simplearena;
148
149simplearena * simplearena_init(size_t bytes) { 147simplearena * simplearena_init(size_t bytes) {
150 return arena_init(bytes); 148 return arena_init(bytes);
151} 149}