add error catching and output if mempool alloc/init fails.

SVN revision: 37321
This commit is contained in:
Carsten Haitzler 2008-10-29 23:12:56 +00:00
parent 59c00da15a
commit b4f33c6358
2 changed files with 21 additions and 0 deletions

View File

@ -64,6 +64,10 @@
# include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
@ -428,8 +432,18 @@ eina_list_init(void)
_eina_list_mp = eina_mempool_new(choice, "list", NULL,
sizeof (Eina_List), 320);
if (!_eina_list_mp)
{
fprintf(stderr, "ERROR: Mempool for list cannot be allocated in list init.\n");
abort();
}
_eina_list_accounting_mp = eina_mempool_new(choice, "list_accounting", NULL,
sizeof (Eina_List_Accounting), 80);
if (!_eina_list_accounting_mp)
{
fprintf(stderr, "ERROR: Mempool for list accounting cannot be allocated in list init.\n");
abort();
}
eina_magic_string_set(EINA_MAGIC_ITERATOR,
"Eina Iterator");

View File

@ -22,6 +22,8 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "eina_mempool.h"
#include "eina_hash.h"
@ -122,6 +124,11 @@ eina_mempool_init(void)
_backends = eina_hash_string_superfast_new(NULL);
/* dynamic backends */
_modules = eina_module_list_get(PACKAGE_LIB_DIR "/eina/mp/", 0, NULL, NULL);
if (!_modules)
{
fprintf(stderr, "ERROR: no mempool modules able to be loaded.\n");
abort();
}
eina_module_list_load(_modules);
/* builtin backends */
#ifdef EINA_STATIC_BUILD_CHAINED_POOL