eolian: store units in state

This commit is contained in:
Daniel Kolesa 2017-12-07 19:03:00 +01:00
parent 8653d8cd73
commit 3ebd1f1506
3 changed files with 7 additions and 6 deletions

View File

@ -1047,7 +1047,7 @@ eo_lexer_set_input(Eo_Lexer *ls, Eolian *state, const char *source)
Eolian_Unit *ncunit = calloc(1, sizeof(Eolian_Unit));
database_unit_init(state, ncunit, ls->filename);
eina_hash_add(_units, ls->filename, ncunit);
eina_hash_add(state->units, ls->filename, ncunit);
}
static void

View File

@ -10,7 +10,6 @@
Eina_Hash *_decls = NULL;
Eina_Hash *_declsf = NULL;
Eina_Hash *_units = NULL;
static Eolian_Unit *_cunit = NULL;
@ -29,7 +28,6 @@ database_init()
eina_init();
_decls = eina_hash_stringshared_new(free);
_declsf = eina_hash_stringshared_new(_hashlist_free);
_units = eina_hash_stringshared_new(EINA_FREE_CB(database_unit_del));
return ++_database_init_count;
}
@ -47,7 +45,6 @@ database_shutdown()
{
eina_hash_free(_decls ); _decls = NULL;
eina_hash_free(_declsf ); _declsf = NULL;
eina_hash_free(_units ); _units = NULL;
eina_shutdown();
}
return _database_init_count;
@ -601,6 +598,8 @@ eolian_new(void)
state->parsing = 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);
state->aliases_f = eina_hash_stringshared_new(_hashlist_free);
state->structs_f = eina_hash_stringshared_new(_hashlist_free);
@ -626,6 +625,8 @@ eolian_free(Eolian *state)
eina_hash_free(state->parsing);
eina_hash_free(state->defer);
eina_hash_free(state->units);
eina_hash_free(state->classes_f);
eina_hash_free(state->aliases_f);
eina_hash_free(state->structs_f);

View File

@ -35,8 +35,6 @@ extern Eina_Prefix *_eolian_prefix;
extern Eina_Hash *_decls;
extern Eina_Hash *_declsf;
extern Eina_Hash *_units;
struct _Eolian_Unit
{
Eolian *state;
@ -61,6 +59,8 @@ struct _Eolian
Eina_Hash *parsed;
Eina_Hash *defer;
Eina_Hash *units;
Eina_Hash *classes_f;
Eina_Hash *aliases_f;
Eina_Hash *structs_f;