simplify evas_init() and evas_shutdown() a bit

SVN revision: 42956
This commit is contained in:
Vincent Torri 2009-10-08 06:25:09 +00:00
parent 9e8c44052d
commit 7902ce1bb7
1 changed files with 33 additions and 30 deletions

View File

@ -2,7 +2,7 @@
#include "evas_private.h"
#include "evas_cs.h"
static int initcount = 0;
static int _evas_init_count = 0;
int _evas_log_dom_global = -1;
/**
* Initialize Evas
@ -18,36 +18,39 @@ int _evas_log_dom_global = -1;
EAPI int
evas_init(void)
{
if (initcount == 0)
if (++_evas_init_count != 1)
return _evas_init_count;
if (!eina_init())
return 0;
_evas_log_dom_global = eina_log_domain_register("evas_main",EVAS_DEFAULT_LOG_COLOR);
if (_evas_log_dom_global < 0)
{
if (!eina_init())
return 0;
_evas_log_dom_global = eina_log_domain_register("evas_main",EVAS_DEFAULT_LOG_COLOR);
if(_evas_log_dom_global < 0)
{
fprintf(stderr,"Error: Evas could not create a default log domain\n");
eina_shutdown();
return 0;
}
evas_module_init();
fprintf(stderr,"Error: Evas could not create a default log domain\n");
goto shutdown_eina;
}
evas_module_init();
#ifdef BUILD_ASYNC_EVENTS
if (!evas_async_events_init())
goto shutdown_module;
if (!evas_async_events_init())
goto shutdown_module;
#endif
#ifdef EVAS_CSERVE
if (getenv("EVAS_CSERVE")) evas_cserve_init();
if (getenv("EVAS_CSERVE")) evas_cserve_init();
#endif
}
return ++initcount;
return _evas_init_count;
#ifdef BUILD_ASYNC_EVENTS
shutdown_module:
evas_module_shutdown();
eina_log_domain_unregister(_evas_log_dom_global);
#endif
shutdown_eina:
eina_shutdown();
return 0;
#endif
}
/**
@ -65,22 +68,22 @@ evas_init(void)
EAPI int
evas_shutdown(void)
{
initcount--;
if (initcount == 0)
{
if (--_evas_init_count != 0)
return _evas_init_count;
#ifdef EVAS_CSERVE
if (getenv("EVAS_CSERVE")) evas_cserve_shutdown();
if (getenv("EVAS_CSERVE")) evas_cserve_shutdown();
#endif
#ifdef BUILD_ASYNC_EVENTS
evas_async_events_shutdown();
evas_async_events_shutdown();
#endif
evas_font_dir_cache_free();
evas_common_shutdown();
evas_module_shutdown();
eina_log_domain_unregister(_evas_log_dom_global);
eina_shutdown();
}
return initcount;
evas_font_dir_cache_free();
evas_common_shutdown();
evas_module_shutdown();
eina_log_domain_unregister(_evas_log_dom_global);
eina_shutdown();
return _evas_init_count;
}
/**