aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-02-28 11:47:37 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2019-02-28 12:01:31 +0100
commit73cbc48669d20db2903d36bc028eda2a6bd64247 (patch)
tree4fb24bd85889b6d27f541566b67a4bd23d6b58a4
parenteina: safe guard against macro expension error in EINA_*_EQ (diff)
downloadefl-73cbc48669d20db2903d36bc028eda2a6bd64247.tar.gz
eolian: Fix struct database registration.
Summary: It was mistankely swapping regular and inlist structs when registering after parsing, causing functions like eolian_state_structs_by_file_get to return wrong data, breaking C# bindings. Also added a simple test. Reviewers: q66, bu5hm4n, zmike, cedric, felipealmeida, segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8047
-rw-r--r--src/lib/eolian/database_type.c4
-rw-r--r--src/tests/eolian/eolian_parsing.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index d629a44395..7db0fe2fa1 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -53,8 +53,8 @@ database_struct_add(Eolian_Unit *unit, Eolian_Typedecl *tp, Eina_Bool is_inlist)
{
EOLIAN_OBJECT_ADD(unit, tp->base.name, tp, structs);
}
- Eina_Hash *sh = is_inlist ? unit->state->staging.structs_f
- : unit->state->staging.inlists_f;
+ Eina_Hash *sh = is_inlist ? unit->state->staging.inlists_f
+ : unit->state->staging.structs_f;
eina_hash_set(sh, tp->base.file, eina_list_append
((Eina_List*)eina_hash_find(sh, tp->base.file), tp));
database_object_add(unit, &tp->base);
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 53ffbe67fe..3d2b4dbcfe 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -686,6 +686,7 @@ EFL_START_TEST(eolian_struct)
const Eolian_Unit *unit;
const char *type_name;
const char *file;
+ Eina_Iterator *structs;
Eolian_State *eos = eolian_state_new();
@@ -697,6 +698,9 @@ EFL_START_TEST(eolian_struct)
fail_if(!(class = eolian_unit_class_by_name_get(unit, "Struct")));
fail_if(!eolian_class_function_by_name_get(class, "foo", EOLIAN_METHOD));
+ fail_if(!(structs = eolian_state_structs_by_file_get(eos, "struct.eo")));
+ eina_iterator_free(structs);
+
/* named struct */
fail_if(!(tdl = eolian_unit_struct_by_name_get(unit, "Named")));
fail_if(!(type_name = eolian_typedecl_short_name_get(tdl)));