diff options
Diffstat (limited to 'mempool/src')
-rw-r--r-- | mempool/src/mempool.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mempool/src/mempool.c b/mempool/src/mempool.c index 46f1053..444d602 100644 --- a/mempool/src/mempool.c +++ b/mempool/src/mempool.c | |||
@@ -34,7 +34,7 @@ bool mempool_make_( | |||
34 | block_info = calloc(num_blocks, sizeof(BlockInfo)); | 34 | block_info = calloc(num_blocks, sizeof(BlockInfo)); |
35 | blocks = calloc(num_blocks, block_size_bytes); | 35 | blocks = calloc(num_blocks, block_size_bytes); |
36 | pool->dynamic = true; | 36 | pool->dynamic = true; |
37 | if ((block_info == 0) || (blocks == 0)) { | 37 | if ((block_info == nullptr) || (blocks == nullptr)) { |
38 | return false; | 38 | return false; |
39 | } | 39 | } |
40 | } else { | 40 | } else { |
@@ -55,11 +55,11 @@ void mempool_del_(mempool* pool) { | |||
55 | if (pool->dynamic) { | 55 | if (pool->dynamic) { |
56 | if (pool->block_info) { | 56 | if (pool->block_info) { |
57 | free(pool->block_info); | 57 | free(pool->block_info); |
58 | pool->block_info = 0; | 58 | pool->block_info = nullptr; |
59 | } | 59 | } |
60 | if (pool->blocks) { | 60 | if (pool->blocks) { |
61 | free(pool->blocks); | 61 | free(pool->blocks); |
62 | pool->blocks = 0; | 62 | pool->blocks = nullptr; |
63 | } | 63 | } |
64 | } | 64 | } |
65 | } | 65 | } |
@@ -81,7 +81,7 @@ void* mempool_alloc_(mempool* pool) { | |||
81 | if (pool->trap) { | 81 | if (pool->trap) { |
82 | FAIL("mempool allocation failed, increase the pool's capacity."); | 82 | FAIL("mempool allocation failed, increase the pool's capacity."); |
83 | } | 83 | } |
84 | return 0; // Pool is full. | 84 | return nullptr; // Pool is full. |
85 | } | 85 | } |
86 | 86 | ||
87 | // Allocate the block. | 87 | // Allocate the block. |
@@ -124,7 +124,7 @@ void mempool_free_(mempool* pool, void** block_ptr) { | |||
124 | 124 | ||
125 | pool->num_used_blocks--; | 125 | pool->num_used_blocks--; |
126 | 126 | ||
127 | *block_ptr = 0; | 127 | *block_ptr = nullptr; |
128 | } | 128 | } |
129 | 129 | ||
130 | void* mempool_get_block_(const mempool* pool, size_t block_index) { | 130 | void* mempool_get_block_(const mempool* pool, size_t block_index) { |