From 245563fa783d3906c7a68e623a5576dc8957b91a Mon Sep 17 00:00:00 2001 From: Angus Jull Date: Thu, 16 May 2024 00:25:42 -0400 Subject: [PATCH] Remove arena_alloc Missed in the merge, but will fix the git history later --- src/arena_alloc.c | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 src/arena_alloc.c diff --git a/src/arena_alloc.c b/src/arena_alloc.c deleted file mode 100644 index 4471239..0000000 --- a/src/arena_alloc.c +++ /dev/null @@ -1,23 +0,0 @@ -#include "arena_alloc.h" -#include - -/** - * Allocates memory of size `nbytes` on the arena. - * @param arena The arena to allocate on. - * @param nbytes The number of bytes to allocate on the arena. - * @return NULL if there is not enough space in the arena to allocate `nbytes`, a pointer to `nbytes` of memory - * otherwise. - */ -void *aalloc(arena_t *arena, size_t nbytes) { - if (nbytes == 0) return NULL; - if ((uint8_t *)(arena->cur) + nbytes > (uint8_t *)(arena->start) + arena->size) return NULL; - void *allocated_memory = arena->cur; - arena->cur = (uint8_t *)(arena->cur) + nbytes; - return allocated_memory; -} - -/** - * Frees all memory on the arena. - * @param arena The arena to free memory on. - */ -void afree(arena_t *arena) { arena->cur = arena->start; }