{
char *level;
/* TODO register the eina's basic errors */
- /* TODO load the environment variable for getting the log level */
if ((level = getenv("EINA_ERROR_LEVEL")))
{
_error_level = atoi(level);
{
char *path;
- eina_hash_init();
- eina_module_init();
+ if (!eina_hash_init())
+ {
+ fprintf(stderr, "Could not initialize eina hash module.\n");
+ return 0;
+ }
+ if (!eina_module_init())
+ {
+ fprintf(stderr, "Could not initialize eina module module.\n");
+ goto module_init_error;
+ }
EINA_ERROR_NOT_MEMPOOL_MODULE = eina_error_msg_register("Not a memory pool module.");
_backends = eina_hash_string_superfast_new(NULL);
if (!_modules)
{
EINA_ERROR_PERR("ERROR: no mempool modules able to be loaded.\n");
- abort();
+ eina_hash_free(_backends);
+ goto mempool_init_error;
}
eina_module_list_load(_modules);
/* builtin backends */
#endif
}
return ++_init_count;
+
+ mempool_init_error:
+ eina_module_shutdown();
+ module_init_error:
+ eina_hash_shutdown();
+
+ return 0;
+
}
/**
ememoa_fixed_shutdown();
#endif
/* dynamic backends */
- eina_module_list_unload(_modules);
+ eina_module_list_delete(_modules);
+ if (_modules)
+ eina_array_free(_modules);
+
eina_module_shutdown();
- /* TODO delete the _modules list */
+
+ if (_backends)
+ eina_hash_free(_backends);
+
eina_hash_shutdown();
return 0;
}