fix: major bug in allocator

This commit is contained in:
2026-01-12 20:45:02 +02:00
parent 21a5e3e068
commit 4bf1ccd9e7
2 changed files with 3 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
RELEASE_flags=-DNDEBUG -O2 -g0 RELEASE_flags=-DNDEBUG -O2 -g0
DEBUG_flags=-std=c23 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og DEBUG_flags=-std=c23 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -O0
clean: clean:
rm -fr bin rm -fr bin

View File

@@ -81,8 +81,9 @@ niarena_alloc(NIArena **self, size_t size)
niarena_error("niarena_alloc: out of memory inside of the arena"); niarena_error("niarena_alloc: out of memory inside of the arena");
return NULL; return NULL;
} }
void *ret = (void *)(((char *)arena->buffer) + arena->offset);
arena->offset += size; arena->offset += size;
return (void *)((char *)arena->buffer + arena->offset); return ret;
} }
void void