diff options
Diffstat (limited to 'src/arena.c')
| -rw-r--r-- | src/arena.c | 6 |
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) { | |||
| 51 | arena * arena_init(size_t bytes) { | 51 | arena * 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 | |||
| 147 | typedef arena simplearena; | ||
| 148 | |||
| 149 | simplearena * simplearena_init(size_t bytes) { | 147 | simplearena * simplearena_init(size_t bytes) { |
| 150 | return arena_init(bytes); | 148 | return arena_init(bytes); |
| 151 | } | 149 | } |
