Arena allocation
This commit is contained in:
+5
-5
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user