src/mempool.c

changeset 985
68754c7de906
parent 970
c9b02747cfc5
--- a/src/mempool.c	Thu Nov 07 20:22:56 2024 +0100
+++ b/src/mempool.c	Thu Nov 07 22:46:58 2024 +0100
@@ -138,6 +138,7 @@
 }
 
 void cxMempoolDestroy(CxMempool *pool) {
+    if (pool == NULL) return;
     struct cx_mempool_memory_s *mem;
     for (size_t i = 0; i < pool->size; i++) {
         mem = pool->data[i];
@@ -158,6 +159,10 @@
     *(cx_destructor_func *) ((char *) ptr - sizeof(cx_destructor_func)) = func;
 }
 
+void cxMempoolRemoveDestructor(void *ptr) {
+    *(cx_destructor_func *) ((char *) ptr - sizeof(cx_destructor_func)) = NULL;
+}
+
 struct cx_mempool_foreign_mem_s {
     cx_destructor_func destr;
     void* mem;

mercurial