Arena allocation

This commit is contained in:
2026-06-25 20:48:45 -05:00
parent ae29e4a72d
commit 3b5dc6cb38
4 changed files with 159 additions and 5 deletions
+5 -5
View File
@@ -34,7 +34,7 @@ void*
ci2_alloc(size_t nbytes, const char* file, int line)
{
void* ptr;
ci2_rt_assert(nbytes > 0);
CI2_ASSERT(nbytes > 0);
ptr = malloc(nbytes);
if (ptr == NULL) {
if (file == NULL)
@@ -49,8 +49,8 @@ void*
ci2_calloc(size_t count, size_t nbytes, const char* file, int line)
{
void* ptr;
ci2_rt_assert(count > 0);
ci2_rt_assert(nbytes > 0);
CI2_ASSERT(count > 0);
CI2_ASSERT(nbytes > 0);
ptr = calloc(count, nbytes);
if (ptr == NULL) {
if (file == NULL)
@@ -74,8 +74,8 @@ ci2_free(void* ptr, const char* file, int line)
void*
ci2_resize(void* ptr, size_t nbytes, const char* file, int line)
{
// ci2_rt_assert(ptr); // ? Maybe
// ci2_rt_assert(nbytes > 0);// ? Maybe
// CI2_ASSERT(ptr); // ? Maybe
// CI2_ASSERT(nbytes > 0);// ? Maybe
void* tmp = realloc(ptr, nbytes);
if (tmp == NULL) {
if (file == NULL)