Mon, 10 Feb 2025 19:24:26 +0100
change name of cxBasicMempoolCreate() to cxMempoolCreateSimple() - fixes #590
CHANGELOG | file | annotate | diff | comparison | revisions | |
src/cx/mempool.h | file | annotate | diff | comparison | revisions | |
tests/test_mempool.c | file | annotate | diff | comparison | revisions |
--- a/CHANGELOG Mon Feb 10 19:20:43 2025 +0100 +++ b/CHANGELOG Mon Feb 10 19:24:26 2025 +0100 @@ -22,6 +22,7 @@ * adds improved version of UCX 2 Test framework (now a self-contained header) * adds cx_nmemb() utility function to common.h * changes that CxMap returns own CxMapIterator to save memory in CxIterator + * changes name of cxBasicMempoolCreate() to cxMempoolCreateSimple() * changes all functions, for which there is no dedicated xyz_a variant, to accept NULL as allocator argument (in which case a default allocator will be used) * changes the name of destroy functions that actually free the memory to better indicate their behavior
--- a/src/cx/mempool.h Mon Feb 10 19:20:43 2025 +0100 +++ b/src/cx/mempool.h Mon Feb 10 19:24:26 2025 +0100 @@ -102,7 +102,7 @@ * @param capacity (@c size_t) the initial capacity of the pool * @return (@c CxMempool*) the created memory pool or @c NULL if allocation failed */ -#define cxBasicMempoolCreate(capacity) cxMempoolCreate(capacity, NULL) +#define cxMempoolCreateSimple(capacity) cxMempoolCreate(capacity, NULL) /** * Sets the destructor function for a specific allocated memory object.
--- a/tests/test_mempool.c Mon Feb 10 19:20:43 2025 +0100 +++ b/tests/test_mempool.c Mon Feb 10 19:24:26 2025 +0100 @@ -32,7 +32,7 @@ #include "cx/mempool.h" CX_TEST(test_mempool_create) { - CxMempool *pool = cxBasicMempoolCreate(16); + CxMempool *pool = cxMempoolCreateSimple(16); CX_TEST_DO { CX_TEST_ASSERT(pool->auto_destr == NULL); CX_TEST_ASSERT(pool->allocator != NULL); @@ -50,7 +50,7 @@ } CX_TEST(test_mempool_malloc) { - CxMempool *pool = cxBasicMempoolCreate(4); + CxMempool *pool = cxMempoolCreateSimple(4); CX_TEST_DO { CX_TEST_ASSERT(cxMalloc(pool->allocator, sizeof(int)) != NULL); CX_TEST_ASSERT(cxMalloc(pool->allocator, sizeof(int)) != NULL); @@ -69,7 +69,7 @@ } CX_TEST(test_mempool_calloc) { - CxMempool *pool = cxBasicMempoolCreate(4); + CxMempool *pool = cxMempoolCreateSimple(4); CX_TEST_DO { int *test = cxCalloc(pool->allocator, 2, sizeof(int)); CX_TEST_ASSERT(test != NULL); @@ -112,7 +112,7 @@ CX_TEST(test_mempool_free) { - CxMempool *pool = cxBasicMempoolCreate(4); + CxMempool *pool = cxMempoolCreateSimple(4); void *mem1, *mem2; CX_TEST_DO { mem1 = cxMalloc(pool->allocator, 16); @@ -135,7 +135,7 @@ } CX_TEST(test_mempool_destroy) { - CxMempool *pool = cxBasicMempoolCreate(4); + CxMempool *pool = cxMempoolCreateSimple(4); CX_TEST_DO { int *data = cxMalloc(pool->allocator, sizeof(int)); *data = 13; @@ -152,7 +152,7 @@ } CX_TEST(test_mempool_register) { - CxMempool *pool = cxBasicMempoolCreate(4); + CxMempool *pool = cxMempoolCreateSimple(4); CX_TEST_DO { int *data = cxMalloc(pool->allocator, sizeof(int)); test_mempool_destructor_called = 0;