q66 pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f8cef784a88234d801b6959fdd592bb10c40ebe7
commit f8cef784a88234d801b6959fdd592bb10c40ebe7 Author: Daniel Kolesa <d.kol...@samsung.com> Date: Fri Sep 12 14:20:52 2014 +0100 eolian: less messy initialization checks --- src/lib/eolian/database_type.c | 14 +++++--------- src/lib/eolian/database_var.c | 15 ++++++--------- src/lib/eolian/eolian_database.c | 17 +++++++++++++++++ src/lib/eolian/eolian_database.h | 8 ++++---- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c index b74f080..884e501 100644 --- a/src/lib/eolian/database_type.c +++ b/src/lib/eolian/database_type.c @@ -41,32 +41,28 @@ database_typedef_del(Eolian_Type *tp) database_type_del(tp); } -Eina_Bool +void database_type_add(Eolian_Type *def) { - if (!_aliases) return EINA_FALSE; eina_hash_set(_aliases, def->full_name, def); eina_hash_set(_aliasesf, def->base.file, eina_list_append ((Eina_List*)eina_hash_find(_aliasesf, def->base.file), def)); - return EINA_TRUE; } -Eina_Bool database_struct_add(Eolian_Type *tp) +void +database_struct_add(Eolian_Type *tp) { - if (!_structs) return EINA_FALSE; eina_hash_set(_structs, tp->full_name, tp); eina_hash_set(_structsf, tp->base.file, eina_list_append ((Eina_List*)eina_hash_find(_structsf, tp->base.file), tp)); - return EINA_TRUE; } -Eina_Bool database_enum_add(Eolian_Type *tp) +void +database_enum_add(Eolian_Type *tp) { - if (!_enums) return EINA_FALSE; eina_hash_set(_enums, tp->full_name, tp); eina_hash_set(_enumsf, tp->base.file, eina_list_append ((Eina_List*)eina_hash_find(_enumsf, tp->base.file), tp)); - return EINA_TRUE; } static void diff --git a/src/lib/eolian/database_var.c b/src/lib/eolian/database_var.c index 0b0b1d9..69d15a3 100644 --- a/src/lib/eolian/database_var.c +++ b/src/lib/eolian/database_var.c @@ -18,30 +18,27 @@ database_var_del(Eolian_Variable *var) free(var); } -static Eina_Bool +static void database_var_global_add(Eolian_Variable *var) { - if (!_globals) return EINA_FALSE; eina_hash_set(_globals, var->full_name, var); eina_hash_set(_globalsf, var->base.file, eina_list_append ((Eina_List*)eina_hash_find(_globalsf, var->base.file), var)); - return EINA_TRUE; } -static Eina_Bool +static void database_var_constant_add(Eolian_Variable *var) { - if (!_constants) return EINA_FALSE; eina_hash_set(_constants, var->full_name, var); eina_hash_set(_constantsf, var->base.file, eina_list_append ((Eina_List*)eina_hash_find(_constantsf, var->base.file), var)); - return EINA_TRUE; } -Eina_Bool +void database_var_add(Eolian_Variable *var) { if (var->type == EOLIAN_VAR_GLOBAL) - return database_var_global_add(var); - return database_var_constant_add(var); + database_var_global_add(var); + else + database_var_constant_add(var); } diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c index 3ef0955..5bae78d 100644 --- a/src/lib/eolian/eolian_database.c +++ b/src/lib/eolian/eolian_database.c @@ -201,6 +201,8 @@ database_class_name_validate(const char *class_name, const Eolian_Class **cl) EAPI Eina_Bool eolian_eot_file_parse(const char *filepath) { + if (_database_init_count <= 0) + return EINA_FALSE; return eo_parser_database_fill(filepath, EINA_TRUE); } @@ -210,6 +212,10 @@ eolian_eo_file_parse(const char *filepath) Eina_Iterator *itr; Eina_List *depl; Eolian_Dependency *dep; + + if (_database_init_count <= 0) + return EINA_FALSE; + char *bfiledup = strdup(filepath); char *bfilename = basename(bfiledup); const Eolian_Class *class = eolian_class_get_by_file(bfilename); @@ -317,6 +323,10 @@ EAPI Eina_Bool eolian_all_eot_files_parse() { Eina_Bool ret = EINA_TRUE; + + if (_database_init_count <= 0) + return EINA_FALSE; + eina_hash_foreach(_tfilenames, _tfile_parse, &ret); return ret; } @@ -332,6 +342,10 @@ EAPI Eina_Bool eolian_all_eo_files_parse() { Eina_Bool ret = EINA_TRUE; + + if (_database_init_count <= 0) + return EINA_FALSE; + eina_hash_foreach(_filenames, _file_parse, &ret); return ret; } @@ -339,5 +353,8 @@ eolian_all_eo_files_parse() EAPI Eina_Bool eolian_database_validate(void) { + if (_database_init_count <= 0) + return EINA_FALSE; + return database_validate(); } diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index bb487f0..6777e5a 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -249,9 +249,9 @@ Eina_Bool database_class_name_validate(const char *class_name, const Eolian_Clas /* types */ -Eina_Bool database_type_add(Eolian_Type *def); -Eina_Bool database_struct_add(Eolian_Type *tp); -Eina_Bool database_enum_add(Eolian_Type *tp); +void database_type_add(Eolian_Type *def); +void database_struct_add(Eolian_Type *tp); +void database_enum_add(Eolian_Type *tp); void database_type_del(Eolian_Type *tp); void database_typedef_del(Eolian_Type *tp); @@ -267,7 +267,7 @@ void database_expr_print(Eolian_Expression *expr); /* variables */ void database_var_del(Eolian_Variable *var); -Eina_Bool database_var_add(Eolian_Variable *var); +void database_var_add(Eolian_Variable *var); /* classes */ void database_class_del(Eolian_Class *cl); --