From 12d9a508b56e5b99652712ffe3e766150facfce8 Mon Sep 17 00:00:00 2001 From: raster Date: Wed, 29 Oct 2008 23:12:56 +0000 Subject: [PATCH] add error catching and output if mempool alloc/init fails. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@37321 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/eina_list.c | 14 ++++++++++++++ src/lib/eina_mempool.c | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/src/lib/eina_list.c b/src/lib/eina_list.c index cc07c79..f14b17d 100644 --- a/src/lib/eina_list.c +++ b/src/lib/eina_list.c @@ -64,6 +64,10 @@ # include "config.h" #endif +#include +#include +#include + #ifdef HAVE_EVIL # include #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"); diff --git a/src/lib/eina_mempool.c b/src/lib/eina_mempool.c index dff05f3..3dcf4a3 100644 --- a/src/lib/eina_mempool.c +++ b/src/lib/eina_mempool.c @@ -22,6 +22,8 @@ #include #include +#include +#include #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 -- 2.7.4