eolian: no need to store 'parsed' table anymore either

This commit is contained in:
Daniel Kolesa 2018-01-31 19:14:15 +01:00
parent 8b1f2f34b4
commit a6d0e787e4
3 changed files with 14 additions and 24 deletions

View File

@ -2245,22 +2245,19 @@ parse_chunk(Eo_Lexer *ls, Eina_Bool eot)
Eolian_Unit *
eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot)
{
Eolian_Unit *ret = NULL;
if (eina_hash_find(parent->state->parsed, filename))
{
const char *fsl = strrchr(filename, '/');
const char *bsl = strrchr(filename, '\\');
const char *fname = NULL;
if (fsl || bsl)
fname = eina_stringshare_add((fsl > bsl) ? (fsl + 1) : (bsl + 1));
if (fname)
{
ret = eina_hash_find(parent->state->units, fname);
eina_stringshare_del(fname);
return ret;
}
return NULL;
}
const char *fsl = strrchr(filename, '/');
const char *bsl = strrchr(filename, '\\');
const char *fname = NULL;
if (fsl || bsl)
fname = eina_stringshare_add((fsl > bsl) ? (fsl + 1) : (bsl + 1));
else
fname = eina_stringshare_add(filename);
Eolian_Unit *ret = eina_hash_find(parent->state->units, fname);
eina_stringshare_del(fname);
if (ret)
return ret;
Eo_Lexer *ls = eo_lexer_new(parent->state, filename);
if (!ls)
@ -2292,7 +2289,6 @@ eo_parser_database_fill(Eolian_Unit *parent, const char *filename, Eina_Bool eot
done:
ret = ls->unit;
eina_hash_set(ls->state->parsed, filename, (void *)EINA_TRUE);
eina_hash_add(parent->children, filename, ret);
eo_lexer_free(ls);

View File

@ -550,9 +550,7 @@ eolian_new(void)
state->filenames_eo = eina_hash_string_small_new(free);
state->filenames_eot = eina_hash_string_small_new(free);
state->parsed = eina_hash_string_small_new(NULL);
state->defer = eina_hash_string_small_new(NULL);
state->defer = eina_hash_string_small_new(NULL);
state->units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del));
state->classes_f = eina_hash_stringshared_new(NULL);
@ -577,9 +575,7 @@ eolian_free(Eolian *state)
eina_hash_free(state->filenames_eo);
eina_hash_free(state->filenames_eot);
eina_hash_free(state->parsed);
eina_hash_free(state->defer);
eina_hash_free(state->units);
eina_hash_free(state->classes_f);

View File

@ -51,9 +51,7 @@ struct _Eolian
Eina_Hash *filenames_eo; /* filename to full path mapping */
Eina_Hash *filenames_eot;
Eina_Hash *parsed;
Eina_Hash *defer;
Eina_Hash *units;
Eina_Hash *classes_f;