# HG changeset patch # User Mike Becker # Date 1769030668 -3600 # Node ID 3f05e8f97b22c3d94757237aa5c3e3513a1b0b01 # Parent abb995453f15559f566d491418e232282140778e mempool.h - internalize structs that are not C++ compatible relates to #799 diff -r abb995453f15 -r 3f05e8f97b22 src/cx/mempool.h --- a/src/cx/mempool.h Wed Jan 21 22:07:03 2026 +0100 +++ b/src/cx/mempool.h Wed Jan 21 22:24:28 2026 +0100 @@ -39,38 +39,6 @@ #include "common.h" #include "allocator.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; -}; - /** Specifies how individual blocks are allocated. */ enum cx_mempool_type { /** 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