simplify evas_init() and evas_shutdown() a bit
SVN revision: 42956
This commit is contained in:
parent
9e8c44052d
commit
7902ce1bb7
|
@ -2,7 +2,7 @@
|
||||||
#include "evas_private.h"
|
#include "evas_private.h"
|
||||||
#include "evas_cs.h"
|
#include "evas_cs.h"
|
||||||
|
|
||||||
static int initcount = 0;
|
static int _evas_init_count = 0;
|
||||||
int _evas_log_dom_global = -1;
|
int _evas_log_dom_global = -1;
|
||||||
/**
|
/**
|
||||||
* Initialize Evas
|
* Initialize Evas
|
||||||
|
@ -18,36 +18,39 @@ int _evas_log_dom_global = -1;
|
||||||
EAPI int
|
EAPI int
|
||||||
evas_init(void)
|
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())
|
fprintf(stderr,"Error: Evas could not create a default log domain\n");
|
||||||
return 0;
|
goto shutdown_eina;
|
||||||
_evas_log_dom_global = eina_log_domain_register("evas_main",EVAS_DEFAULT_LOG_COLOR);
|
}
|
||||||
if(_evas_log_dom_global < 0)
|
|
||||||
{
|
evas_module_init();
|
||||||
fprintf(stderr,"Error: Evas could not create a default log domain\n");
|
|
||||||
eina_shutdown();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
evas_module_init();
|
|
||||||
#ifdef BUILD_ASYNC_EVENTS
|
#ifdef BUILD_ASYNC_EVENTS
|
||||||
if (!evas_async_events_init())
|
if (!evas_async_events_init())
|
||||||
goto shutdown_module;
|
goto shutdown_module;
|
||||||
#endif
|
#endif
|
||||||
#ifdef EVAS_CSERVE
|
#ifdef EVAS_CSERVE
|
||||||
if (getenv("EVAS_CSERVE")) evas_cserve_init();
|
if (getenv("EVAS_CSERVE")) evas_cserve_init();
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
return ++initcount;
|
return _evas_init_count;
|
||||||
|
|
||||||
#ifdef BUILD_ASYNC_EVENTS
|
#ifdef BUILD_ASYNC_EVENTS
|
||||||
shutdown_module:
|
shutdown_module:
|
||||||
evas_module_shutdown();
|
evas_module_shutdown();
|
||||||
eina_log_domain_unregister(_evas_log_dom_global);
|
eina_log_domain_unregister(_evas_log_dom_global);
|
||||||
|
#endif
|
||||||
|
shutdown_eina:
|
||||||
eina_shutdown();
|
eina_shutdown();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,22 +68,22 @@ evas_init(void)
|
||||||
EAPI int
|
EAPI int
|
||||||
evas_shutdown(void)
|
evas_shutdown(void)
|
||||||
{
|
{
|
||||||
initcount--;
|
if (--_evas_init_count != 0)
|
||||||
if (initcount == 0)
|
return _evas_init_count;
|
||||||
{
|
|
||||||
#ifdef EVAS_CSERVE
|
#ifdef EVAS_CSERVE
|
||||||
if (getenv("EVAS_CSERVE")) evas_cserve_shutdown();
|
if (getenv("EVAS_CSERVE")) evas_cserve_shutdown();
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_ASYNC_EVENTS
|
#ifdef BUILD_ASYNC_EVENTS
|
||||||
evas_async_events_shutdown();
|
evas_async_events_shutdown();
|
||||||
#endif
|
#endif
|
||||||
evas_font_dir_cache_free();
|
evas_font_dir_cache_free();
|
||||||
evas_common_shutdown();
|
evas_common_shutdown();
|
||||||
evas_module_shutdown();
|
evas_module_shutdown();
|
||||||
eina_log_domain_unregister(_evas_log_dom_global);
|
eina_log_domain_unregister(_evas_log_dom_global);
|
||||||
eina_shutdown();
|
eina_shutdown();
|
||||||
}
|
|
||||||
return initcount;
|
return _evas_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue