summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-07 18:58:21 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-12-07 19:11:58 +0100
commite7bf69fc0476b46790bb1b74f7d0fa63b6d8bd88 (patch)
treeb108671250162a36788661841977b4fdcc3d9aa7 /src
parent2343e6cc54e76f84bd327c3283d4bb4abf5c9af4 (diff)
eolian: make deferred parsing map non-global
Diffstat (limited to 'src')
-rw-r--r--src/lib/eolian/eo_lexer.c2
-rw-r--r--src/lib/eolian/eo_parser.c2
-rw-r--r--src/lib/eolian/eolian_database.c12
-rw-r--r--src/lib/eolian/eolian_database.h4
4 files changed, 8 insertions, 12 deletions
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index 9594d4a4b6..e646eaad98 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -278,7 +278,7 @@ doc_ref_class(Eo_Lexer *ls, const char *cname)
278 const char *eop = eina_hash_find(ls->state->filenames_eo, buf); 278 const char *eop = eina_hash_find(ls->state->filenames_eo, buf);
279 if (!eop) 279 if (!eop)
280 return; 280 return;
281 eina_hash_set(_defereos, buf, eop); 281 eina_hash_set(ls->state->defer, buf, eop);
282} 282}
283 283
284static void 284static void
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index a077245ab6..e8cecef038 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -2189,7 +2189,7 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
2189 eo_lexer_syntax_error(ls, errbuf); 2189 eo_lexer_syntax_error(ls, errbuf);
2190 } 2190 }
2191 } 2191 }
2192 eina_hash_set(_defereos, eina_strbuf_string_get(buf), found); 2192 eina_hash_set(ls->state->defer, eina_strbuf_string_get(buf), found);
2193 pop_strbuf(ls); 2193 pop_strbuf(ls);
2194 eo_lexer_get(ls); 2194 eo_lexer_get(ls);
2195 check_next(ls, ';'); 2195 check_next(ls, ';');
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 8ebb974ae0..5629b9e908 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -12,8 +12,6 @@ Eina_Hash *_decls = NULL;
12Eina_Hash *_declsf = NULL; 12Eina_Hash *_declsf = NULL;
13Eina_Hash *_units = NULL; 13Eina_Hash *_units = NULL;
14 14
15Eina_Hash *_defereos = NULL;
16
17static Eolian_Unit *_cunit = NULL; 15static Eolian_Unit *_cunit = NULL;
18 16
19static int _database_init_count = 0; 17static int _database_init_count = 0;
@@ -31,7 +29,6 @@ database_init()
31 eina_init(); 29 eina_init();
32 _decls = eina_hash_stringshared_new(free); 30 _decls = eina_hash_stringshared_new(free);
33 _declsf = eina_hash_stringshared_new(_hashlist_free); 31 _declsf = eina_hash_stringshared_new(_hashlist_free);
34 _defereos = eina_hash_string_small_new(NULL);
35 _units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del)); 32 _units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del));
36 return ++_database_init_count; 33 return ++_database_init_count;
37} 34}
@@ -50,7 +47,6 @@ database_shutdown()
50 { 47 {
51 eina_hash_free(_decls ); _decls = NULL; 48 eina_hash_free(_decls ); _decls = NULL;
52 eina_hash_free(_declsf ); _declsf = NULL; 49 eina_hash_free(_declsf ); _declsf = NULL;
53 eina_hash_free(_defereos ); _defereos = NULL;
54 eina_hash_free(_units ); _units = NULL; 50 eina_hash_free(_units ); _units = NULL;
55 eina_shutdown(); 51 eina_shutdown();
56 } 52 }
@@ -603,6 +599,7 @@ eolian_new(void)
603 599
604 state->parsed = eina_hash_string_small_new(NULL); 600 state->parsed = eina_hash_string_small_new(NULL);
605 state->parsing = eina_hash_string_small_new(NULL); 601 state->parsing = eina_hash_string_small_new(NULL);
602 state->defer = eina_hash_string_small_new(NULL);
606 603
607 state->classes_f = eina_hash_stringshared_new(NULL); 604 state->classes_f = eina_hash_stringshared_new(NULL);
608 state->aliases_f = eina_hash_stringshared_new(_hashlist_free); 605 state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
@@ -621,6 +618,7 @@ eolian_free(Eolian *state)
621 return; 618 return;
622 619
623 database_unit_del(&state->unit); 620 database_unit_del(&state->unit);
621
624 free(state); 622 free(state);
625} 623}
626 624
@@ -715,11 +713,11 @@ _eolian_file_parse_nodep(Eolian *state, const char *filepath)
715static Eina_Bool 713static Eina_Bool
716_parse_deferred(Eolian *state) 714_parse_deferred(Eolian *state)
717{ 715{
718 Eina_Hash *defer = _defereos; 716 Eina_Hash *defer = state->defer;
719 if (!defer || !eina_hash_population(defer)) 717 if (!defer || !eina_hash_population(defer))
720 return EINA_TRUE; 718 return EINA_TRUE;
721 /* clean room for more deps for later parsing */ 719 /* clean room for more deps for later parsing */
722 _defereos = eina_hash_string_small_new(NULL); 720 state->defer = eina_hash_string_small_new(NULL);
723 Eina_Iterator *itr = eina_hash_iterator_data_new(defer); 721 Eina_Iterator *itr = eina_hash_iterator_data_new(defer);
724 const char *dep; 722 const char *dep;
725 EINA_ITERATOR_FOREACH(itr, dep) 723 EINA_ITERATOR_FOREACH(itr, dep)
@@ -727,7 +725,7 @@ _parse_deferred(Eolian *state)
727 if (!_eolian_file_parse_nodep(state, dep)) 725 if (!_eolian_file_parse_nodep(state, dep))
728 { 726 {
729 eina_iterator_free(itr); 727 eina_iterator_free(itr);
730 eina_hash_free_buckets(_defereos); 728 eina_hash_free_buckets(state->defer);
731 eina_hash_free(defer); 729 eina_hash_free(defer);
732 return EINA_FALSE; 730 return EINA_FALSE;
733 } 731 }
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index eaf55f801a..5168df904f 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -37,9 +37,6 @@ extern Eina_Hash *_declsf;
37 37
38extern Eina_Hash *_units; 38extern Eina_Hash *_units;
39 39
40/* for deferred dependency parsing */
41extern Eina_Hash *_defereos;
42
43struct _Eolian_Unit 40struct _Eolian_Unit
44{ 41{
45 Eolian *state; 42 Eolian *state;
@@ -62,6 +59,7 @@ struct _Eolian
62 59
63 Eina_Hash *parsing; 60 Eina_Hash *parsing;
64 Eina_Hash *parsed; 61 Eina_Hash *parsed;
62 Eina_Hash *defer;
65 63
66 Eina_Hash *classes_f; 64 Eina_Hash *classes_f;
67 Eina_Hash *aliases_f; 65 Eina_Hash *aliases_f;