summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-19 15:44:33 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-19 15:44:33 +0100
commit30515bc946622dcc03322916184f36003e40b062 (patch)
treeab17f3c88c264f8a98bf530829761952c73b0a65
parentb647448f84309d53eb4d71d909d436b0bb4c7894 (diff)
eolian: cleaner cyclic import checks
-rw-r--r--src/lib/eolian/database_fill.c8
-rw-r--r--src/lib/eolian/eo_parser.c10
2 files changed, 11 insertions, 7 deletions
diff --git a/src/lib/eolian/database_fill.c b/src/lib/eolian/database_fill.c
index 00dd224980..58eaace475 100644
--- a/src/lib/eolian/database_fill.c
+++ b/src/lib/eolian/database_fill.c
@@ -218,6 +218,8 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
218 if (eot && eina_hash_find(_parsedeots, filename)) 218 if (eot && eina_hash_find(_parsedeots, filename))
219 return EINA_TRUE; 219 return EINA_TRUE;
220 220
221 if (eot) eina_hash_set(_parsingeots, filename, (void *)EINA_TRUE);
222
221 ls = eo_lexer_new(filename); 223 ls = eo_lexer_new(filename);
222 if (!ls) 224 if (!ls)
223 { 225 {
@@ -254,12 +256,16 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
254 256
255done: 257done:
256 if (eot) 258 if (eot)
257 eina_hash_set(_parsedeots, filename, (void *)EINA_TRUE); 259 {
260 eina_hash_set(_parsedeots, filename, (void *)EINA_TRUE);
261 eina_hash_set(_parsingeots, filename, (void *)EINA_FALSE);
262 }
258 263
259 eo_lexer_free(ls); 264 eo_lexer_free(ls);
260 return EINA_TRUE; 265 return EINA_TRUE;
261 266
262error: 267error:
268 if (eot) eina_hash_set(_parsingeots, filename, (void *)EINA_FALSE);
263 eo_lexer_free(ls); 269 eo_lexer_free(ls);
264 return EINA_FALSE; 270 return EINA_FALSE;
265} 271}
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 30b1ced3b7..774bf146fa 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -1798,22 +1798,21 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
1798 check(ls, TOK_VALUE); 1798 check(ls, TOK_VALUE);
1799 eina_strbuf_append(buf, ls->t.value.s); 1799 eina_strbuf_append(buf, ls->t.value.s);
1800 eina_strbuf_append(buf, ".eot"); 1800 eina_strbuf_append(buf, ".eot");
1801 if (eina_hash_find(_parsingeots, ls->t.value.s)) 1801 if (!(found = eina_hash_find(_tfilenames, eina_strbuf_string_get(buf))))
1802 { 1802 {
1803 pop_strbuf(ls); 1803 pop_strbuf(ls);
1804 snprintf(errbuf, sizeof(errbuf), 1804 snprintf(errbuf, sizeof(errbuf),
1805 "cyclic import '%s'", ls->t.value.s); 1805 "unknown import '%s'", ls->t.value.s);
1806 eo_lexer_syntax_error(ls, errbuf); 1806 eo_lexer_syntax_error(ls, errbuf);
1807 } 1807 }
1808 if (!(found = eina_hash_find(_tfilenames, eina_strbuf_string_get(buf)))) 1808 if (eina_hash_find(_parsingeots, found))
1809 { 1809 {
1810 pop_strbuf(ls); 1810 pop_strbuf(ls);
1811 snprintf(errbuf, sizeof(errbuf), 1811 snprintf(errbuf, sizeof(errbuf),
1812 "unknown import '%s'", ls->t.value.s); 1812 "cyclic import '%s'", ls->t.value.s);
1813 eo_lexer_syntax_error(ls, errbuf); 1813 eo_lexer_syntax_error(ls, errbuf);
1814 } 1814 }
1815 pop_strbuf(ls); 1815 pop_strbuf(ls);
1816 eina_hash_set(_parsingeots, ls->t.value.s, (void *)EINA_TRUE);
1817 if (!eo_parser_database_fill(found, EINA_TRUE)) 1816 if (!eo_parser_database_fill(found, EINA_TRUE))
1818 { 1817 {
1819 pop_strbuf(ls); 1818 pop_strbuf(ls);
@@ -1821,7 +1820,6 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
1821 "error while parsing import '%s'", ls->t.value.s); 1820 "error while parsing import '%s'", ls->t.value.s);
1822 eo_lexer_syntax_error(ls, errbuf); 1821 eo_lexer_syntax_error(ls, errbuf);
1823 } 1822 }
1824 eina_hash_set(_parsingeots, ls->t.value.s, (void *)EINA_FALSE);
1825 pop_strbuf(ls); 1823 pop_strbuf(ls);
1826 eo_lexer_get(ls); 1824 eo_lexer_get(ls);
1827 check_next(ls, ';'); 1825 check_next(ls, ';');