summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-01-31 19:06:37 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-01-31 19:06:37 +0100
commit8b1f2f34b4688249a9697ced7f7d25f7bcee2bea (patch)
tree34297c84bfacda590c0bdd3bbe9567cd98ee442d
parentf0877c9329248624c44d2cca113e737ee7f1ba50 (diff)
eolian: simplify parsed checking
-rw-r--r--src/lib/eolian/eo_parser.c11
-rw-r--r--src/lib/eolian/eo_parser.h2
-rw-r--r--src/lib/eolian/eolian_database.c8
3 files changed, 9 insertions, 12 deletions
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 5a6938b606..9ad7fd9874 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -2243,13 +2243,11 @@ parse_chunk(Eo_Lexer *ls, Eina_Bool eot)
2243} 2243}
2244 2244
2245Eolian_Unit * 2245Eolian_Unit *
2246eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot, Eolian_Class **fcl) 2246eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot)
2247{ 2247{
2248 Eolian_Unit *ret = NULL; 2248 Eolian_Unit *ret = NULL;
2249 Eolian_Class *cl = eina_hash_find(parent->state->parsed, filename); 2249 if (eina_hash_find(parent->state->parsed, filename))
2250 if (cl)
2251 { 2250 {
2252 if (!eot && fcl) *fcl = cl;
2253 const char *fsl = strrchr(filename, '/'); 2251 const char *fsl = strrchr(filename, '/');
2254 const char *bsl = strrchr(filename, '\\'); 2252 const char *bsl = strrchr(filename, '\\');
2255 const char *fname = NULL; 2253 const char *fname = NULL;
@@ -2280,6 +2278,7 @@ eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot
2280 parse_chunk(ls, eot); 2278 parse_chunk(ls, eot);
2281 if (eot) goto done; 2279 if (eot) goto done;
2282 2280
2281 Eolian_Class *cl;
2283 if (!(cl = ls->tmp.kls)) 2282 if (!(cl = ls->tmp.kls))
2284 { 2283 {
2285 _eolian_log("eolian: no class for file '%s'", filename); 2284 _eolian_log("eolian: no class for file '%s'", filename);
@@ -2291,11 +2290,9 @@ eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot
2291 eina_hash_set(ls->state->classes_f, cl->base.file, cl); 2290 eina_hash_set(ls->state->classes_f, cl->base.file, cl);
2292 eolian_object_ref(&cl->base); 2291 eolian_object_ref(&cl->base);
2293 2292
2294 if (fcl) *fcl = cl;
2295
2296done: 2293done:
2297 ret = ls->unit; 2294 ret = ls->unit;
2298 eina_hash_set(ls->state->parsed, filename, eot ? (void *)EINA_TRUE : cl); 2295 eina_hash_set(ls->state->parsed, filename, (void *)EINA_TRUE);
2299 eina_hash_add(parent->children, filename, ret); 2296 eina_hash_add(parent->children, filename, ret);
2300 2297
2301 eo_lexer_free(ls); 2298 eo_lexer_free(ls);
diff --git a/src/lib/eolian/eo_parser.h b/src/lib/eolian/eo_parser.h
index f7422e4704..52029138fc 100644
--- a/src/lib/eolian/eo_parser.h
+++ b/src/lib/eolian/eo_parser.h
@@ -3,6 +3,6 @@
3 3
4#include "eo_lexer.h" 4#include "eo_lexer.h"
5 5
6Eolian_Unit *eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot, Eolian_Class **cl); 6Eolian_Unit *eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot);
7 7
8#endif /* __EO_PARSER_H__ */ \ No newline at end of file 8#endif /* __EO_PARSER_H__ */ \ No newline at end of file
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 49dbe73853..93aba59d38 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -673,11 +673,11 @@ _eolian_file_parse_nodep(Eolian_Unit *parent, const char *filepath)
673 if (!(eopath = eina_hash_find(is_eo ? parent->state->filenames_eo : parent->state->filenames_eot, filepath))) 673 if (!(eopath = eina_hash_find(is_eo ? parent->state->filenames_eo : parent->state->filenames_eot, filepath)))
674 { 674 {
675 char *vpath = eina_file_path_sanitize(filepath); 675 char *vpath = eina_file_path_sanitize(filepath);
676 Eolian_Unit *ret = eo_parser_database_fill(parent, vpath, !is_eo, NULL); 676 Eolian_Unit *ret = eo_parser_database_fill(parent, vpath, !is_eo);
677 free(vpath); 677 free(vpath);
678 return ret; 678 return ret;
679 } 679 }
680 return eo_parser_database_fill(parent, eopath, !is_eo, NULL); 680 return eo_parser_database_fill(parent, eopath, !is_eo);
681} 681}
682 682
683static Eina_Bool 683static Eina_Bool
@@ -734,7 +734,7 @@ static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key
734 Parse_Data *pd = fdata; 734 Parse_Data *pd = fdata;
735 Eolian_Unit *unit = NULL; 735 Eolian_Unit *unit = NULL;
736 if (pd->ret) 736 if (pd->ret)
737 unit = eo_parser_database_fill((Eolian_Unit *)pd->state, data, EINA_TRUE, NULL); 737 unit = eo_parser_database_fill((Eolian_Unit *)pd->state, data, EINA_TRUE);
738 pd->ret = !!unit; 738 pd->ret = !!unit;
739 if (pd->ret) pd->ret = _parse_deferred(unit); 739 if (pd->ret) pd->ret = _parse_deferred(unit);
740 return pd->ret; 740 return pd->ret;
@@ -762,7 +762,7 @@ static Eina_Bool _file_parse(const Eina_Hash *hash EINA_UNUSED, const void *key
762 Parse_Data *pd = fdata; 762 Parse_Data *pd = fdata;
763 Eolian_Unit *unit = NULL; 763 Eolian_Unit *unit = NULL;
764 if (pd->ret) 764 if (pd->ret)
765 unit = eo_parser_database_fill((Eolian_Unit *)pd->state, data, EINA_FALSE, NULL); 765 unit = eo_parser_database_fill((Eolian_Unit *)pd->state, data, EINA_FALSE);
766 pd->ret = !!unit; 766 pd->ret = !!unit;
767 if (pd->ret) pd->ret = _parse_deferred(unit); 767 if (pd->ret) pd->ret = _parse_deferred(unit);
768 return pd->ret; 768 return pd->ret;