aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-16 14:49:35 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-16 14:49:35 +0100
commita84827878270dae73012bd7de9306c136b6f5a4d (patch)
treea3a159e22341542e886ad693550f2f6547187964
parenteolian: event/function_get_by_name -> by_name_get (diff)
downloadefl-a84827878270dae73012bd7de9306c136b6f5a4d.tar.gz
eolian: simplify lexer init
-rw-r--r--src/lib/eolian/eo_lexer.c34
-rw-r--r--src/lib/eolian/eo_lexer.h4
2 files changed, 6 insertions, 32 deletions
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index ac64c7b5e5..56b1bb7fc9 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -114,8 +114,8 @@ throw(Eo_Lexer *ls, const char *fmt, ...)
longjmp(ls->err_jmp, EINA_TRUE);
}
-static void
-init_hash(void)
+void
+eo_lexer_init(void)
{
unsigned int i;
if (keyword_map) return;
@@ -124,8 +124,8 @@ init_hash(void)
eina_hash_add(keyword_map, keywords[i], (void *)(size_t)(i + 1));
}
-static void
-destroy_hash(void)
+void
+eo_lexer_shutdown(void)
{
if (keyword_map)
{
@@ -1279,32 +1279,6 @@ eo_lexer_get_c_type(int kw)
return ctypes[kw - KW_byte];
}
-static int _init_counter = 0;
-
-int
-eo_lexer_init()
-{
- if (!_init_counter)
- {
- eina_init();
- init_hash();
- }
- return _init_counter++;
-}
-
-int
-eo_lexer_shutdown()
-{
- if (_init_counter <= 0) return 0;
- _init_counter--;
- if (!_init_counter)
- {
- destroy_hash();
- eina_shutdown();
- }
- return _init_counter;
-}
-
static Eina_Bool
_eo_is_tokstr(int t) {
return (t == TOK_STRING) || (t == TOK_VALUE);
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h
index 4381c2e517..c1797d0d7b 100644
--- a/src/lib/eolian/eo_lexer.h
+++ b/src/lib/eolian/eo_lexer.h
@@ -193,8 +193,8 @@ typedef struct _Eo_Lexer
char decpoint;
} Eo_Lexer;
-int eo_lexer_init (void);
-int eo_lexer_shutdown (void);
+void eo_lexer_init (void);
+void eo_lexer_shutdown (void);
Eo_Lexer *eo_lexer_new (Eolian_State *state, const char *source);
void eo_lexer_free (Eo_Lexer *ls);
/* gets a regular token, singlechar or one of TOK_something */