eina mempool: don't allow 0 sized mempools

there is no point in having a mempool with a max 0 size. this leads to
us mallocing 0 bytes for the base. not good. make minimim size 1. :)

@fix
This commit is contained in:
Carsten Haitzler 2016-04-17 12:13:25 +09:00
parent 75c741ff2b
commit b7d882515d
1 changed files with 2 additions and 0 deletions

View File

@ -217,9 +217,11 @@ eina_one_big_init(const char *context,
return NULL;
item_size = va_arg(args, int);
if (item_size < 1) item_size = 1;
pool->item_size = eina_mempool_alignof(item_size);
pool->max = va_arg(args, int);
if (pool->max < 1) pool->max = 1;
pool->offset_to_item_inlist = pool->item_size;
if (pool->offset_to_item_inlist % (int)sizeof(void *) != 0)