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:
parent
287e5727fb
commit
3d22238976
1 changed files with 1 additions and 3 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue