From 3d22238976174ea2d2ac43ba549f19fb8198e1cd Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 30 Oct 2016 23:01:14 -0400 Subject: [PATCH] make pool initialisation more robust by allowing non-pow2 pool sizes (we will use the next bigger power-of-2 for the internal queue) --- lib/pool.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/pool.c b/lib/pool.c index 7db22d59c..df187790b 100644 --- a/lib/pool.c +++ b/lib/pool.c @@ -25,10 +25,8 @@ int pool_init(struct pool *p, size_t cnt, size_t blocksz, const struct memtype * p->buffer = memory_alloc_aligned(m, p->len, p->alignment); if (!p->buffer) serror("Failed to allocate memory for memory pool"); - else - debug(DBG_POOL | 4, "Allocated %#zx bytes for memory pool", p->len); - ret = queue_init(&p->queue, cnt, m); + ret = queue_init(&p->queue, LOG2_CEIL(cnt), m); if (ret) return ret;