summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-07 19:03:00 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-07 19:11:58 +0100
commit3ebd1f150629e3f68d83a4a2d8ef33e3124db540 (patch)
treef686dd77eec53e013782ade9fc7ac555ed3ba539 /src
parent8653d8cd73076e47ea342f4c15cf29b0c245325b (diff)
eolian: store units in state
Diffstat (limited to 'src')
-rw-r--r--src/lib/eolian/eo_lexer.c2
-rw-r--r--src/lib/eolian/eolian_database.c7
-rw-r--r--src/lib/eolian/eolian_database.h4
3 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index e646eaad98..1aa02ae777 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -1047,7 +1047,7 @@ eo_lexer_set_input(Eo_Lexer *ls, Eolian *state, const char *source)
1047 1047
1048 Eolian_Unit *ncunit = calloc(1, sizeof(Eolian_Unit)); 1048 Eolian_Unit *ncunit = calloc(1, sizeof(Eolian_Unit));
1049 database_unit_init(state, ncunit, ls->filename); 1049 database_unit_init(state, ncunit, ls->filename);
1050 eina_hash_add(_units, ls->filename, ncunit); 1050 eina_hash_add(state->units, ls->filename, ncunit);
1051} 1051}
1052 1052
1053static void 1053static void
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 9161be0328..ff24ba3dd3 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -10,7 +10,6 @@
10 10
11Eina_Hash *_decls = NULL; 11Eina_Hash *_decls = NULL;
12Eina_Hash *_declsf = NULL; 12Eina_Hash *_declsf = NULL;
13Eina_Hash *_units = NULL;
14 13
15static Eolian_Unit *_cunit = NULL; 14static Eolian_Unit *_cunit = NULL;
16 15
@@ -29,7 +28,6 @@ database_init()
29 eina_init(); 28 eina_init();
30 _decls = eina_hash_stringshared_new(free); 29 _decls = eina_hash_stringshared_new(free);
31 _declsf = eina_hash_stringshared_new(_hashlist_free); 30 _declsf = eina_hash_stringshared_new(_hashlist_free);
32 _units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del));
33 return ++_database_init_count; 31 return ++_database_init_count;
34} 32}
35 33
@@ -47,7 +45,6 @@ database_shutdown()
47 { 45 {
48 eina_hash_free(_decls ); _decls = NULL; 46 eina_hash_free(_decls ); _decls = NULL;
49 eina_hash_free(_declsf ); _declsf = NULL; 47 eina_hash_free(_declsf ); _declsf = NULL;
50 eina_hash_free(_units ); _units = NULL;
51 eina_shutdown(); 48 eina_shutdown();
52 } 49 }
53 return _database_init_count; 50 return _database_init_count;
@@ -601,6 +598,8 @@ eolian_new(void)
601 state->parsing = eina_hash_string_small_new(NULL); 598 state->parsing = eina_hash_string_small_new(NULL);
602 state->defer = eina_hash_string_small_new(NULL); 599 state->defer = eina_hash_string_small_new(NULL);
603 600
601 state->units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del));
602
604 state->classes_f = eina_hash_stringshared_new(NULL); 603 state->classes_f = eina_hash_stringshared_new(NULL);
605 state->aliases_f = eina_hash_stringshared_new(_hashlist_free); 604 state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
606 state->structs_f = eina_hash_stringshared_new(_hashlist_free); 605 state->structs_f = eina_hash_stringshared_new(_hashlist_free);
@@ -626,6 +625,8 @@ eolian_free(Eolian *state)
626 eina_hash_free(state->parsing); 625 eina_hash_free(state->parsing);
627 eina_hash_free(state->defer); 626 eina_hash_free(state->defer);
628 627
628 eina_hash_free(state->units);
629
629 eina_hash_free(state->classes_f); 630 eina_hash_free(state->classes_f);
630 eina_hash_free(state->aliases_f); 631 eina_hash_free(state->aliases_f);
631 eina_hash_free(state->structs_f); 632 eina_hash_free(state->structs_f);
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 5168df904f..56fabc099e 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -35,8 +35,6 @@ extern Eina_Prefix *_eolian_prefix;
35extern Eina_Hash *_decls; 35extern Eina_Hash *_decls;
36extern Eina_Hash *_declsf; 36extern Eina_Hash *_declsf;
37 37
38extern Eina_Hash *_units;
39
40struct _Eolian_Unit 38struct _Eolian_Unit
41{ 39{
42 Eolian *state; 40 Eolian *state;
@@ -61,6 +59,8 @@ struct _Eolian
61 Eina_Hash *parsed; 59 Eina_Hash *parsed;
62 Eina_Hash *defer; 60 Eina_Hash *defer;
63 61
62 Eina_Hash *units;
63
64 Eina_Hash *classes_f; 64 Eina_Hash *classes_f;
65 Eina_Hash *aliases_f; 65 Eina_Hash *aliases_f;
66 Eina_Hash *structs_f; 66 Eina_Hash *structs_f;