From: Daniel Kolesa Date: Wed, 31 Jan 2018 18:06:37 +0000 (+0100) Subject: eolian: simplify parsed checking X-Git-Tag: upstream/1.21.0~2088 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3cdea55e9d408ab830280bd785093127474c77ec;p=platform%2Fupstream%2Fefl.git eolian: simplify parsed checking --- diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 5a6938b..9ad7fd9 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) } Eolian_Unit * -eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot, Eolian_Class **fcl) +eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot) { Eolian_Unit *ret = NULL; - Eolian_Class *cl = eina_hash_find(parent->state->parsed, filename); - if (cl) + if (eina_hash_find(parent->state->parsed, filename)) { - if (!eot && fcl) *fcl = cl; const char *fsl = strrchr(filename, '/'); const char *bsl = strrchr(filename, '\\'); const char *fname = NULL; @@ -2280,6 +2278,7 @@ eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot parse_chunk(ls, eot); if (eot) goto done; + Eolian_Class *cl; if (!(cl = ls->tmp.kls)) { _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 eina_hash_set(ls->state->classes_f, cl->base.file, cl); eolian_object_ref(&cl->base); - if (fcl) *fcl = cl; - done: ret = ls->unit; - eina_hash_set(ls->state->parsed, filename, eot ? (void *)EINA_TRUE : cl); + eina_hash_set(ls->state->parsed, filename, (void *)EINA_TRUE); eina_hash_add(parent->children, filename, ret); eo_lexer_free(ls); diff --git a/src/lib/eolian/eo_parser.h b/src/lib/eolian/eo_parser.h index f7422e4..5202913 100644 --- a/src/lib/eolian/eo_parser.h +++ b/src/lib/eolian/eo_parser.h @@ -3,6 +3,6 @@ #include "eo_lexer.h" -Eolian_Unit *eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot, Eolian_Class **cl); +Eolian_Unit *eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot); #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 49dbe73..93aba59 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) if (!(eopath = eina_hash_find(is_eo ? parent->state->filenames_eo : parent->state->filenames_eot, filepath))) { char *vpath = eina_file_path_sanitize(filepath); - Eolian_Unit *ret = eo_parser_database_fill(parent, vpath, !is_eo, NULL); + Eolian_Unit *ret = eo_parser_database_fill(parent, vpath, !is_eo); free(vpath); return ret; } - return eo_parser_database_fill(parent, eopath, !is_eo, NULL); + return eo_parser_database_fill(parent, eopath, !is_eo); } static Eina_Bool @@ -734,7 +734,7 @@ static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key Parse_Data *pd = fdata; Eolian_Unit *unit = NULL; if (pd->ret) - unit = eo_parser_database_fill((Eolian_Unit *)pd->state, data, EINA_TRUE, NULL); + unit = eo_parser_database_fill((Eolian_Unit *)pd->state, data, EINA_TRUE); pd->ret = !!unit; if (pd->ret) pd->ret = _parse_deferred(unit); return pd->ret; @@ -762,7 +762,7 @@ static Eina_Bool _file_parse(const Eina_Hash *hash EINA_UNUSED, const void *key Parse_Data *pd = fdata; Eolian_Unit *unit = NULL; if (pd->ret) - unit = eo_parser_database_fill((Eolian_Unit *)pd->state, data, EINA_FALSE, NULL); + unit = eo_parser_database_fill((Eolian_Unit *)pd->state, data, EINA_FALSE); pd->ret = !!unit; if (pd->ret) pd->ret = _parse_deferred(unit); return pd->ret;