diff -r abb995453f15 -r 3f05e8f97b22 src/mempool.c --- 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 #include +/** 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