diff -r 99a34860c105 -r d938228c382e src/server/util/pool.c --- a/src/server/util/pool.c Wed Nov 02 19:19:01 2022 +0100 +++ b/src/server/util/pool.c Sun Nov 06 15:53:32 2022 +0100 @@ -78,6 +78,14 @@ /* Pool global statistics */ static pool_global_stats_t pool_global_stats; +/* ucx allocator pool class */ +static cx_allocator_class pool_allocator_class = { + (void *(*)(void *,size_t )) pool_malloc, + (void *(*)(void *,void *, size_t )) pool_realloc, + (void *(*)(void *,size_t ,size_t )) pool_calloc, + (void (*)(void *, void *))pool_free +}; + static int pool_internal_init() { @@ -134,6 +142,10 @@ return REQ_PROCEED; } +CxAllocator* pool_allocator(pool_handle_t *pool) { + return &((pool_t *)pool)->allocator; +} + static block_t * _create_block(pool_t *pool, int size) { @@ -250,7 +262,10 @@ //if (pool_global_stats.lock == NULL) { // TODO: remove // pool_internal_init(); //} - + + newpool->allocator.cl = &pool_allocator_class; + newpool->allocator.data = newpool; + newpool->used_blocks = NULL; newpool->free_blocks = NULL; newpool->free_size = 0; @@ -718,8 +733,8 @@ #endif /* PER_POOL_STATISTICS */ // new -sstr_t sstrdup_pool(pool_handle_t *pool, sstr_t s) { - sstr_t newstring; +cxmutstr cx_strdup_pool(pool_handle_t *pool, cxmutstr s) { + cxmutstr newstring; newstring.ptr = (char*)pool_malloc(pool, s.length + 1); if (newstring.ptr != NULL) { newstring.length = s.length;