ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9bdaf07d6ec740a92077af17bddbb914898cd315
commit 9bdaf07d6ec740a92077af17bddbb914898cd315 Author: Andy Williams <a...@andywilliams.me> Date: Sun Jan 1 20:10:07 2017 +0000 elm_code: remove unneeded init code. Move elm_code init to the main elementary as that's where it lives --- src/lib/elementary/elm_code.c | 51 ------------------------------ src/lib/elementary/elm_code.h | 28 ---------------- src/lib/elementary/elm_code_private.h | 23 -------------- src/lib/elementary/elm_main.c | 1 + src/lib/elementary/elm_priv.h | 1 + src/tests/elementary/elm_code_test_parse.c | 3 -- 6 files changed, 2 insertions(+), 105 deletions(-) diff --git a/src/lib/elementary/elm_code.c b/src/lib/elementary/elm_code.c index 5062031..38017b7 100644 --- a/src/lib/elementary/elm_code.c +++ b/src/lib/elementary/elm_code.c @@ -9,63 +9,12 @@ #include "elm_code_private.h" -static int _elm_code_init = 0; -EAPI int _elm_code_lib_log_dom = -1; - EAPI const Efl_Event_Description ELM_CODE_EVENT_LINE_LOAD_DONE = EFL_EVENT_DESCRIPTION("line,load,done"); EAPI const Efl_Event_Description ELM_CODE_EVENT_FILE_LOAD_DONE = EFL_EVENT_DESCRIPTION("file,load,done"); -EAPI int -elm_code_init(void) -{ - _elm_code_init++; - if (_elm_code_init > 1) return _elm_code_init; - - eina_init(); - - _elm_code_lib_log_dom = eina_log_domain_register("elm_code", EINA_COLOR_CYAN); - if (_elm_code_lib_log_dom < 0) - { - EINA_LOG_ERR("Elm Code can not create its log domain."); - goto shutdown_eina; - } - - _elm_code_parse_setup(); - - eina_log_timing(_elm_code_lib_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT); - - return _elm_code_init; - - shutdown_eina: - eina_shutdown(); - _elm_code_init--; - - return _elm_code_init; -} - -EAPI int -elm_code_shutdown(void) -{ - _elm_code_init--; - if (_elm_code_init != 0) return _elm_code_init; - - eina_log_timing(_elm_code_lib_log_dom, - EINA_LOG_STATE_START, - EINA_LOG_STATE_SHUTDOWN); - - // Put here your shutdown logic - - eina_log_domain_unregister(_elm_code_lib_log_dom); - _elm_code_lib_log_dom = -1; - - eina_shutdown(); - - return _elm_code_init; -} - EAPI Elm_Code * elm_code_create(void) { diff --git a/src/lib/elementary/elm_code.h b/src/lib/elementary/elm_code.h index 545142c..7b96c04 100644 --- a/src/lib/elementary/elm_code.h +++ b/src/lib/elementary/elm_code.h @@ -42,34 +42,6 @@ extern "C" { */ /** - * Initialize Elm Code. - * - * Initializes Elm Code, its dependencies and modules. Should be the first - * function of Elm Code to be called. - * - * @return The init counter value. - * - * @see elm_code_shutdown(). - * - * @ingroup Init - */ -EAPI int elm_code_init(void); - -/** - * Shutdown Elm Code - * - * Shutdown Elm Code. If init count reaches 0, all the internal structures will - * be freed. Any Elm Code library call after this point will leads to an error. - * - * @return Elm Code's init counter value. - * - * @see elm_code_init() - * - * @ingroup Init - */ -EAPI int elm_code_shutdown(void); - -/** * Create a new Elm Code instance * * This method creates a new Elm Code instance using an in-memory file for backing changes. diff --git a/src/lib/elementary/elm_code_private.h b/src/lib/elementary/elm_code_private.h index e234782..aae7884 100644 --- a/src/lib/elementary/elm_code_private.h +++ b/src/lib/elementary/elm_code_private.h @@ -1,29 +1,6 @@ #ifndef ELM_CODE_PRIVATE_H # define ELM_CODE_PRIVATE_H -extern int _elm_code_lib_log_dom; - -#ifdef ERR -# undef ERR -#endif -#define ERR(...) EINA_LOG_DOM_ERR(_elm_code_lib_log_dom, __VA_ARGS__) -#ifdef INF -# undef INF -#endif -#define INF(...) EINA_LOG_DOM_INFO(_elm_code_lib_log_dom, __VA_ARGS__) -#ifdef WRN -# undef WRN -#endif -#define WRN(...) EINA_LOG_DOM_WARN(_elm_code_lib_log_dom, __VA_ARGS__) -#ifdef CRIT -# undef CRIT -#endif -#define CRIT(...) EINA_LOG_DOM_CRIT(_elm_code_lib_log_dom, __VA_ARGS__) -#ifdef DBG -# undef DBG -#endif -#define DBG(...) EINA_LOG_DOM_DBG(_elm_code_lib_log_dom, __VA_ARGS__) - Eina_Bool _elm_code_text_char_is_whitespace(char c); /* Private parser callbacks */ diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index e21241f..60514bc 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -347,6 +347,7 @@ elm_init(int argc, char **argv) _elm_config->web_backend = "none"; if (!_elm_web_init(_elm_config->web_backend)) _elm_config->web_backend = "none"; + _elm_code_parse_setup(); return _elm_init_count; } diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 320e775..50fc906 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -49,6 +49,7 @@ #include "elm_widget.h" #include "elm_access.eo.h" +#include "elm_code_private.h" #ifdef HAVE_LANGINFO_H # include <langinfo.h> diff --git a/src/tests/elementary/elm_code_test_parse.c b/src/tests/elementary/elm_code_test_parse.c index fb097c5..bc2af0f 100644 --- a/src/tests/elementary/elm_code_test_parse.c +++ b/src/tests/elementary/elm_code_test_parse.c @@ -74,8 +74,6 @@ START_TEST (elm_code_parse_todo_test) Elm_Code_Line *line; elm_init(1, NULL); - elm_code_init(); - code = elm_code_create(); elm_code_parser_standard_add(code, ELM_CODE_PARSER_STANDARD_TODO); file = elm_code_file_new(code); @@ -89,7 +87,6 @@ START_TEST (elm_code_parse_todo_test) elm_code_line_text_set(line, "TOFIX", 5); ck_assert_int_eq(ELM_CODE_STATUS_TYPE_DEFAULT, line->status); - elm_code_shutdown(); elm_shutdown(); } END_TEST --