summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-06 14:15:07 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-06 15:07:31 +0100
commit21db23f702c9cd0592774c6f5526ecebdc8cf817 (patch)
tree13b24ed37875b0450f9498af730a61abb050ca3e /src
parent7491f9353f7e34aa0ae903b28ed09467b0652d75 (diff)
eolian: move global vars to temporary state
Diffstat (limited to 'src')
-rw-r--r--src/lib/eolian/database_validate.c2
-rw-r--r--src/lib/eolian/database_var.c6
-rw-r--r--src/lib/eolian/database_var_api.c10
-rw-r--r--src/lib/eolian/eolian_database.c9
-rw-r--r--src/lib/eolian/eolian_database.h3
5 files changed, 12 insertions, 18 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index b11790950c..beea545404 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -540,7 +540,7 @@ database_validate(const Eolian_Unit *src)
540 if (!rt.succ) 540 if (!rt.succ)
541 return EINA_FALSE; 541 return EINA_FALSE;
542 542
543 eina_hash_foreach(_globals, (Eina_Hash_Foreach)_var_map_cb, &rt); 543 eina_hash_foreach(_state->unit.globals, (Eina_Hash_Foreach)_var_map_cb, &rt);
544 if (!rt.succ) 544 if (!rt.succ)
545 return EINA_FALSE; 545 return EINA_FALSE;
546 546
diff --git a/src/lib/eolian/database_var.c b/src/lib/eolian/database_var.c
index 4ded2873f9..ea7f9015f2 100644
--- a/src/lib/eolian/database_var.c
+++ b/src/lib/eolian/database_var.c
@@ -25,9 +25,9 @@ database_var_del(Eolian_Variable *var)
25static void 25static void
26database_var_global_add(Eolian_Variable *var) 26database_var_global_add(Eolian_Variable *var)
27{ 27{
28 eina_hash_set(_globals, var->full_name, var); 28 eina_hash_set(_state->unit.globals, var->full_name, var);
29 eina_hash_set(_globalsf, var->base.file, eina_list_append 29 eina_hash_set(_state->globals_f, var->base.file, eina_list_append
30 ((Eina_List*)eina_hash_find(_globalsf, var->base.file), var)); 30 ((Eina_List*)eina_hash_find(_state->globals_f, var->base.file), var));
31 database_decl_add(var->full_name, EOLIAN_DECL_VAR, var->base.file, var); 31 database_decl_add(var->full_name, EOLIAN_DECL_VAR, var->base.file, var);
32} 32}
33 33
diff --git a/src/lib/eolian/database_var_api.c b/src/lib/eolian/database_var_api.c
index a0c593d50d..6123ee027e 100644
--- a/src/lib/eolian/database_var_api.c
+++ b/src/lib/eolian/database_var_api.c
@@ -9,9 +9,9 @@ EAPI const Eolian_Variable *
9eolian_variable_global_get_by_name(const Eolian_Unit *unit EINA_UNUSED, 9eolian_variable_global_get_by_name(const Eolian_Unit *unit EINA_UNUSED,
10 const char *name) 10 const char *name)
11{ 11{
12 if (!_globals) return NULL; 12 if (!_state) return NULL;
13 Eina_Stringshare *shr = eina_stringshare_add(name); 13 Eina_Stringshare *shr = eina_stringshare_add(name);
14 Eolian_Variable *v = eina_hash_find(_globals, shr); 14 Eolian_Variable *v = eina_hash_find(_state->unit.globals, shr);
15 eina_stringshare_del(shr); 15 eina_stringshare_del(shr);
16 return v; 16 return v;
17} 17}
@@ -31,9 +31,9 @@ EAPI Eina_Iterator *
31eolian_variable_globals_get_by_file(const Eolian_Unit *unit EINA_UNUSED, 31eolian_variable_globals_get_by_file(const Eolian_Unit *unit EINA_UNUSED,
32 const char *fname) 32 const char *fname)
33{ 33{
34 if (!_globalsf) return NULL; 34 if (!_state) return NULL;
35 Eina_Stringshare *shr = eina_stringshare_add(fname); 35 Eina_Stringshare *shr = eina_stringshare_add(fname);
36 Eina_List *l = eina_hash_find(_globalsf, shr); 36 Eina_List *l = eina_hash_find(_state->globals_f, shr);
37 eina_stringshare_del(shr); 37 eina_stringshare_del(shr);
38 if (!l) return NULL; 38 if (!l) return NULL;
39 return eina_list_iterator_new(l); 39 return eina_list_iterator_new(l);
@@ -60,7 +60,7 @@ eolian_variable_all_constants_get(const Eolian_Unit *unit EINA_UNUSED)
60EAPI Eina_Iterator * 60EAPI Eina_Iterator *
61eolian_variable_all_globals_get(const Eolian_Unit *unit EINA_UNUSED) 61eolian_variable_all_globals_get(const Eolian_Unit *unit EINA_UNUSED)
62{ 62{
63 return (_globals ? eina_hash_iterator_data_new(_globals) : NULL); 63 return (_state ? eina_hash_iterator_data_new(_state->unit.globals) : NULL);
64} 64}
65 65
66EAPI Eolian_Variable_Type 66EAPI Eolian_Variable_Type
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index e364ca6416..582690582d 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -8,9 +8,7 @@
8#include "eolian_database.h" 8#include "eolian_database.h"
9#include "eolian_priv.h" 9#include "eolian_priv.h"
10 10
11Eina_Hash *_globals = NULL;
12Eina_Hash *_constants = NULL; 11Eina_Hash *_constants = NULL;
13Eina_Hash *_globalsf = NULL;
14Eina_Hash *_constantsf = NULL; 12Eina_Hash *_constantsf = NULL;
15Eina_Hash *_filenames = NULL; 13Eina_Hash *_filenames = NULL;
16Eina_Hash *_tfilenames = NULL; 14Eina_Hash *_tfilenames = NULL;
@@ -40,9 +38,7 @@ database_init()
40{ 38{
41 if (_database_init_count > 0) return ++_database_init_count; 39 if (_database_init_count > 0) return ++_database_init_count;
42 eina_init(); 40 eina_init();
43 _globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
44 _constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); 41 _constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
45 _globalsf = eina_hash_stringshared_new(_hashlist_free);
46 _constantsf = eina_hash_stringshared_new(_hashlist_free); 42 _constantsf = eina_hash_stringshared_new(_hashlist_free);
47 _filenames = eina_hash_string_small_new(free); 43 _filenames = eina_hash_string_small_new(free);
48 _tfilenames = eina_hash_string_small_new(free); 44 _tfilenames = eina_hash_string_small_new(free);
@@ -69,9 +65,7 @@ database_shutdown()
69 if (_database_init_count == 0) 65 if (_database_init_count == 0)
70 { 66 {
71 eolian_free(_state); _state = NULL; 67 eolian_free(_state); _state = NULL;
72 eina_hash_free(_globals ); _globals = NULL;
73 eina_hash_free(_constants ); _constants = NULL; 68 eina_hash_free(_constants ); _constants = NULL;
74 eina_hash_free(_globalsf ); _globalsf = NULL;
75 eina_hash_free(_constantsf); _constantsf = NULL; 69 eina_hash_free(_constantsf); _constantsf = NULL;
76 eina_hash_free(_filenames ); _filenames = NULL; 70 eina_hash_free(_filenames ); _filenames = NULL;
77 eina_hash_free(_tfilenames); _tfilenames = NULL; 71 eina_hash_free(_tfilenames); _tfilenames = NULL;
@@ -628,7 +622,8 @@ eolian_new(void)
628 state->classes_f = eina_hash_stringshared_new(NULL); 622 state->classes_f = eina_hash_stringshared_new(NULL);
629 state->aliases_f = eina_hash_stringshared_new(_hashlist_free); 623 state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
630 state->structs_f = eina_hash_stringshared_new(_hashlist_free); 624 state->structs_f = eina_hash_stringshared_new(_hashlist_free);
631 state->enums_f = eina_hash_stringshared_new(_hashlist_free); 625 state->enums_f = eina_hash_stringshared_new(_hashlist_free);
626 state->globals_f = eina_hash_stringshared_new(_hashlist_free);
632 627
633 return state; 628 return state;
634} 629}
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index dc20ab5d0b..fc7735600c 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -31,9 +31,7 @@ extern Eina_Prefix *_eolian_prefix;
31#endif 31#endif
32#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__) 32#define DBG(...) EINA_LOG_DOM_DBG(_eolian_log_dom, __VA_ARGS__)
33 33
34extern Eina_Hash *_globals;
35extern Eina_Hash *_constants; 34extern Eina_Hash *_constants;
36extern Eina_Hash *_globalsf;
37extern Eina_Hash *_constantsf; 35extern Eina_Hash *_constantsf;
38extern Eina_Hash *_filenames; /* Hash: filename without extension -> full path */ 36extern Eina_Hash *_filenames; /* Hash: filename without extension -> full path */
39extern Eina_Hash *_tfilenames; 37extern Eina_Hash *_tfilenames;
@@ -74,6 +72,7 @@ struct _Eolian
74 Eina_Hash *aliases_f; 72 Eina_Hash *aliases_f;
75 Eina_Hash *structs_f; 73 Eina_Hash *structs_f;
76 Eina_Hash *enums_f; 74 Eina_Hash *enums_f;
75 Eina_Hash *globals_f;
77}; 76};
78 77
79typedef struct _Eolian_Object 78typedef struct _Eolian_Object