]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
utilize mm_ctx_mempool() instead of writing by hand
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 22 Dec 2020 13:10:38 +0000 (14:10 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 13 Jan 2021 08:49:13 +0000 (09:49 +0100)
daemon/main.c
daemon/worker.c

index 28c998a750cae1e8275dc008a6cf65626e4ac175..8bbd5609b844733da86a9a82239eb4c419971131 100644 (file)
@@ -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) {
index 7bf9a7543ab55c6433c15e8e48257e3212aefad8..71394cfaa62c4327b99457240b093d7f0926fec8 100644 (file)
@@ -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();
 }