1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

make pool initialisation more robust by allowing non-pow2 pool sizes (we will use the next bigger power-of-2 for the internal queue)

This commit is contained in:
Steffen Vogel 2016-10-30 23:01:14 -04:00
parent 287e5727fb
commit 3d22238976

View file

@ -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;