src/mempool.c

changeset 1702
3f05e8f97b22
parent 1452
26e006ba651d
--- a/src/mempool.c	Wed Jan 21 22:07:03 2026 +0100
+++ b/src/mempool.c	Wed Jan 21 22:24:28 2026 +0100
@@ -31,6 +31,38 @@
 #include <string.h>
 #include <errno.h>
 
+/** A memory block in a simple memory pool. */
+struct cx_mempool_memory_s {
+    /** The destructor. */
+    cx_destructor_func destructor;
+    /** The actual memory. */
+    char c[];
+};
+
+/** A memory block in an advanced memory pool. */
+struct cx_mempool_memory2_s {
+    /** The destructor. */
+    cx_destructor_func2 destructor;
+    /** Data for the destructor. */
+    void *data;
+    /** The actual memory. */
+    char c[];
+};
+
+/** Represents memory that is not allocated by, but registered with a pool. */
+struct cx_mempool_foreign_memory_s {
+    /** The foreign memory. */
+    void* mem;
+    union {
+        /** Simple destructor. */
+        cx_destructor_func destr;
+        /** Advanced destructor. */
+        cx_destructor_func2 destr2;
+    };
+    /** Data for the advanced destructor. */
+    void *destr2_data;
+};
+
 static int cx_mempool_ensure_capacity(
         struct cx_mempool_s *pool,
         size_t needed_capacity

mercurial