diff options
author | 3gg <3gg@shellblade.net> | 2025-07-14 09:16:39 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2025-07-14 09:16:39 -0700 |
commit | 09166d46d6a30c1d431cc8371325d4fc8ae76162 (patch) | |
tree | 745d845daffd500e0d55bc1871ceb0131f9e0457 | |
parent | cc945cad053cd36d67ee5daf50a71e212ce2cfe3 (diff) |
null instead of 0
-rw-r--r-- | mem/include/mem.h | 4 | ||||
-rw-r--r-- | mempool/include/mempool.h | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/mem/include/mem.h b/mem/include/mem.h index 224b069..3050ba8 100644 --- a/mem/include/mem.h +++ b/mem/include/mem.h | |||
@@ -68,13 +68,13 @@ | |||
68 | /// Allocate a new chunk of N blocks. | 68 | /// Allocate a new chunk of N blocks. |
69 | /// Return a pointer to the first block of the chunk. | 69 | /// Return a pointer to the first block of the chunk. |
70 | /// When there is no space left in the allocator, allocation can either trap | 70 | /// When there is no space left in the allocator, allocation can either trap |
71 | /// (default) or gracefully return 0. Call mem_enable_traps() to toggle this | 71 | /// (default) or gracefully return null. Call mem_enable_traps() to toggle this |
72 | /// behaviour. | 72 | /// behaviour. |
73 | /// New chunks are conveniently zeroed out. | 73 | /// New chunks are conveniently zeroed out. |
74 | #define mem_alloc(MEM, num_blocks) mem_alloc_(&(MEM)->mem, num_blocks) | 74 | #define mem_alloc(MEM, num_blocks) mem_alloc_(&(MEM)->mem, num_blocks) |
75 | 75 | ||
76 | /// Free the chunk. | 76 | /// Free the chunk. |
77 | /// The chunk pointer is conveniently set to 0. | 77 | /// The chunk pointer is conveniently set to null. |
78 | #define mem_free(MEM, CHUNK) mem_free_(&(MEM)->mem, (void**)CHUNK) | 78 | #define mem_free(MEM, CHUNK) mem_free_(&(MEM)->mem, (void**)CHUNK) |
79 | 79 | ||
80 | /// Return a pointer to a chunk given the chunk's handle. | 80 | /// Return a pointer to a chunk given the chunk's handle. |
diff --git a/mempool/include/mempool.h b/mempool/include/mempool.h index 04d0313..0de7ac6 100644 --- a/mempool/include/mempool.h +++ b/mempool/include/mempool.h | |||
@@ -64,15 +64,15 @@ | |||
64 | #define mempool_clear(POOL) mempool_clear_(&(POOL)->pool) | 64 | #define mempool_clear(POOL) mempool_clear_(&(POOL)->pool) |
65 | 65 | ||
66 | /// Allocate a new block. | 66 | /// Allocate a new block. |
67 | /// Return 0 if there is no memory left. | 67 | /// Return null if there is no memory left. |
68 | /// When there is no space left in the pool, allocation can either trap | 68 | /// When there is no space left in the pool, allocation can either trap |
69 | /// (default) or gracefully return 0. Call mem_enable_traps() to toggle this | 69 | /// (default) or gracefully return null. Call mem_enable_traps() to toggle this |
70 | /// behaviour. | 70 | /// behaviour. |
71 | /// New blocks are conveniently zeroed out. | 71 | /// New blocks are conveniently zeroed out. |
72 | #define mempool_alloc(POOL) mempool_alloc_(&(POOL)->pool) | 72 | #define mempool_alloc(POOL) mempool_alloc_(&(POOL)->pool) |
73 | 73 | ||
74 | /// Free the block. | 74 | /// Free the block. |
75 | /// The block pointer is conveniently set to 0. | 75 | /// The block pointer is conveniently set to null. |
76 | #define mempool_free(POOL, BLOCK_PTR) \ | 76 | #define mempool_free(POOL, BLOCK_PTR) \ |
77 | assert(*BLOCK_PTR); \ | 77 | assert(*BLOCK_PTR); \ |
78 | mempool_free_(&(POOL)->pool, (void**)BLOCK_PTR) | 78 | mempool_free_(&(POOL)->pool, (void**)BLOCK_PTR) |