From 25a367862dbdfb0fdfdfc6f619af3f0a7e0fe79f Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Mon, 30 Jun 2025 15:29:44 -0700 Subject: Use nullptr --- mem/src/mem.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'mem/src/mem.c') diff --git a/mem/src/mem.c b/mem/src/mem.c index 4f5e5ef..c2af518 100644 --- a/mem/src/mem.c +++ b/mem/src/mem.c @@ -46,11 +46,11 @@ void mem_del_(Memory* mem) { if (mem->dynamic) { if (mem->chunks) { free(mem->chunks); - mem->chunks = 0; + mem->chunks = nullptr; } if (mem->blocks) { free(mem->blocks); - mem->blocks = 0; + mem->blocks = nullptr; } } } @@ -113,10 +113,11 @@ void* mem_alloc_(Memory* mem, size_t num_blocks) { return &mem->blocks[chunk_idx * mem->block_size_bytes]; } else { if (mem->trap) { - FAIL("Memory allocation failed, increase the allocator's capacity or " - "avoid fragmentation."); + FAIL( + "Memory allocation failed, increase the allocator's capacity or " + "avoid fragmentation."); } - return 0; // Large-enough free chunk not found. + return nullptr; // Large-enough free chunk not found. } } @@ -172,7 +173,7 @@ void mem_free_(Memory* mem, void** chunk_ptr) { mem->num_used_blocks--; - *chunk_ptr = 0; + *chunk_ptr = nullptr; } // The handle is the chunk's index. We don't call it an index in the public API -- cgit v1.2.3