src/mempool.c

changeset 1451
b9a384b1226e
parent 1336
5acc23b518aa
child 1452
26e006ba651d
--- a/src/mempool.c	Sun Oct 26 13:08:42 2025 +0100
+++ b/src/mempool.c	Sun Oct 26 15:46:55 2025 +0100
@@ -179,17 +179,15 @@
 }
 
 static void cx_mempool_free_all_simple(const struct cx_mempool_s *pool) {
-    const bool has_destr = pool->destr;
-    const bool has_destr2 = pool->destr2;
     for (size_t i = 0; i < pool->size; i++) {
         struct cx_mempool_memory_s *mem = pool->data[i];
         if (mem->destructor) {
             mem->destructor(mem->c);
         }
-        if (has_destr) {
+        if (pool->destr != NULL) {
             pool->destr(mem->c);
         }
-        if (has_destr2) {
+        if (pool->destr2 != NULL) {
             pool->destr2(pool->destr2_data, mem->c);
         }
         cxFree(pool->base_allocator, mem);

mercurial