# HG changeset patch # User Mike Becker # Date 1739211866 -3600 # Node ID 9998cfb4a65b81f95685e9e447c7e3d1448923bb # Parent 04ede4de9cecd3e682c5cf1185a46d233d734809 change name of cxBasicMempoolCreate() to cxMempoolCreateSimple() - fixes #590 diff -r 04ede4de9cec -r 9998cfb4a65b CHANGELOG --- 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 diff -r 04ede4de9cec -r 9998cfb4a65b src/cx/mempool.h --- 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. diff -r 04ede4de9cec -r 9998cfb4a65b tests/test_mempool.c --- 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;