diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2021-12-05 11:55:10 -0800 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2021-12-05 12:02:10 -0800 |
commit | c200dd832789afa298ba45e0b9efdec96c0e92cc (patch) | |
tree | 4dc5622468a23acfd747e7778eeb9132266d7c9b /src/base/mem/arena.c | |
parent | 8eedf5bdb05c2df0cd339f8742dc4f1752e8aaae (diff) |
Chore: simplified allocator interfaces.
I was never happy with the allocator/reallocator split.
It was originally designed to accomodate things like arenas that don't
free. But the majority of the time you don't care about this.
Diffstat (limited to 'src/base/mem/arena.c')
-rw-r--r-- | src/base/mem/arena.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/base/mem/arena.c b/src/base/mem/arena.c index 37e7b56..7fe036a 100644 --- a/src/base/mem/arena.c +++ b/src/base/mem/arena.c @@ -31,6 +31,13 @@ static void* return mem·arenaalloc(heap, n, size); } +static void* +·arenarealloc(void *heap, void *old, uint n, ulong size) +{ + /* does not free */ + return mem·arenaalloc(heap, n, size); +} + static void ·arenafree(void *heap, void *ptr) { @@ -38,8 +45,9 @@ static void } mem·Allocator mem·ArenaAllocator = { - .alloc = ·arenaalloc, - .free = ·arenafree, + .alloc = ·arenaalloc, + .realloc = ·arenarealloc, + .free = ·arenafree, }; |