From 627da43cee9f6feafd5ebeac3067a46a5d6a4811 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 22 Dec 2020 14:10:38 +0100 Subject: [PATCH] utilize mm_ctx_mempool() instead of writing by hand --- daemon/main.c | 6 ++---- daemon/worker.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/daemon/main.c b/daemon/main.c index 28c998a75..8bbd5609b 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -485,10 +485,8 @@ int main(int argc, char **argv) kr_crypto_init(); /* Create a server engine. */ - knot_mm_t pool = { - .ctx = mp_new (4096), - .alloc = (knot_mm_alloc_t) mp_alloc - }; + knot_mm_t pool; + mm_ctx_mempool(&pool, MM_DEFAULT_BLKSIZE); static struct engine engine; ret = engine_init(&engine, &pool); if (ret != 0) { diff --git a/daemon/worker.c b/daemon/worker.c index 7bf9a7543..71394cfaa 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -2111,8 +2111,7 @@ static int worker_reserve(struct worker_ctx *worker, size_t ring_maxlen) return kr_error(ENOMEM); } - worker->pkt_pool.ctx = mp_new (4 * sizeof(knot_pkt_t)); - worker->pkt_pool.alloc = (knot_mm_alloc_t) mp_alloc; + mm_ctx_mempool(&worker->pkt_pool, 4 * sizeof(knot_pkt_t)); return kr_ok(); } -- 2.47.2