diff options
Diffstat (limited to 'src/libutil/mem_pool.c')
-rw-r--r-- | src/libutil/mem_pool.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c index a292c082a..6c9ee6f16 100644 --- a/src/libutil/mem_pool.c +++ b/src/libutil/mem_pool.c @@ -27,7 +27,6 @@ #include "fstring.h" #include "logger.h" #include "util.h" -#include "utlist.h" #include "main.h" /* Sleep time for spin lock in nanoseconds */ @@ -541,7 +540,8 @@ rspamd_mempool_add_destructor_full (rspamd_mempool_t * pool, cur->data = data; cur->function = function; cur->loc = line; - DL_APPEND (pool->destructors, cur); + cur->prev = pool->destructors; + pool->destructors = cur; POOL_MTX_UNLOCK (); } } @@ -554,12 +554,14 @@ rspamd_mempool_replace_destructor (rspamd_mempool_t * pool, { struct _pool_destructors *tmp; - DL_FOREACH (pool->destructors, tmp) { + tmp = pool->destructors; + while (tmp) { if (tmp->func == func && tmp->data == old_data) { tmp->func = func; tmp->data = new_data; break; } + tmp = tmp->prev; } } @@ -569,15 +571,16 @@ rspamd_mempool_delete (rspamd_mempool_t * pool) { struct _pool_chain *cur = pool->first_pool, *tmp; struct _pool_chain_shared *cur_shared = pool->shared_pool, *tmp_shared; - struct _pool_destructors *destructor; + struct _pool_destructors *destructor = pool->destructors; POOL_MTX_LOCK (); /* Call all pool destructors */ - DL_FOREACH (pool->destructors, destructor) { + while (destructor) { /* Avoid calling destructors for NULL pointers */ if (destructor->data != NULL) { destructor->func (destructor->data); } + destructor = destructor->prev; } while (cur) { |