goto on_exit;
}
+ if (!pool->base)
+ {
+ pool->base = malloc(pool->item_size * pool->max);
+ if (!pool->base)
+ {
+ eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
+ goto retry_smaller;
+ }
+ }
+
if (pool->served < pool->max)
{
mem = pool->base + (pool->served++ *pool->item_size);
goto on_exit;
}
- eina_error_set(0);
+ retry_smaller:
+ eina_error_set(0);
mem = malloc(pool->item_size);
if (!mem)
eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
memcpy((char *)pool->name, context, length);
}
- pool->base = malloc(pool->item_size * pool->max);
- if (!pool->base)
- {
- free(pool);
- return NULL;
- }
-
#ifdef EFL_HAVE_THREADS
# ifdef EFL_HAVE_POSIX_THREADS
pthread_mutex_init(&pool->mutex, NULL);