Update docs and assertions

This commit is contained in:
seajee
2025-11-17 02:49:43 +01:00
parent 38decaf81a
commit bbf3371038

10
arena.h
View File

@@ -77,6 +77,10 @@
// Warning: this functions may cause fragmentation, consider setting an // Warning: this functions may cause fragmentation, consider setting an
// appropriate region capacity. // appropriate region capacity.
// //
// [Note]
//
// This library is not Thread-safe.
//
// [Example] // [Example]
// //
#if 0 #if 0
@@ -171,7 +175,7 @@ Arena arena_create(size_t region_capacity)
void *arena_alloc(Arena *a, size_t size) void *arena_alloc(Arena *a, size_t size)
{ {
if (a == NULL || size == 0) { if (a == NULL || size == 0) {
ARENA_ASSERT(!"Invalid, parameters"); ARENA_ASSERT(false && "Invalid, parameters");
return NULL; return NULL;
} }
@@ -185,7 +189,7 @@ void *arena_alloc(Arena *a, size_t size)
NULL, sizeof(*a->head) + alloc_size); NULL, sizeof(*a->head) + alloc_size);
if (a->head == NULL) { if (a->head == NULL) {
ARENA_ASSERT(!"Reallocation failed"); ARENA_ASSERT(false && "Reallocation failed");
return NULL; return NULL;
} }
@@ -213,7 +217,7 @@ void *arena_alloc(Arena *a, size_t size)
NULL, sizeof(*a->tail) + alloc_size); NULL, sizeof(*a->tail) + alloc_size);
if (a->tail->next == NULL) { if (a->tail->next == NULL) {
ARENA_ASSERT(!"Reallocation failed"); ARENA_ASSERT(false && "Reallocation failed");
return NULL; return NULL;
} }