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

View File

@ -550,9 +550,7 @@ eolian_new(void)
state->filenames_eo = eina_hash_string_small_new(free); state->filenames_eo = eina_hash_string_small_new(free);
state->filenames_eot = 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->units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del));
state->classes_f = eina_hash_stringshared_new(NULL); 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_eo);
eina_hash_free(state->filenames_eot); eina_hash_free(state->filenames_eot);
eina_hash_free(state->parsed);
eina_hash_free(state->defer); eina_hash_free(state->defer);
eina_hash_free(state->units); eina_hash_free(state->units);
eina_hash_free(state->classes_f); 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_eo; /* filename to full path mapping */
Eina_Hash *filenames_eot; Eina_Hash *filenames_eot;
Eina_Hash *parsed;
Eina_Hash *defer; Eina_Hash *defer;
Eina_Hash *units; Eina_Hash *units;
Eina_Hash *classes_f; Eina_Hash *classes_f;