summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-04-11 14:58:41 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-04-11 14:58:41 +0200
commite9811c659677e23b015b2980c0bd10dfb82c7e40 (patch)
treebf5a142d3a4177b031784336f03a2491dea34043
parent710748c55103ba0415f46f5eb8d1ce503b3ea8ce (diff)
eolian: simplify class validation logic
-rw-r--r--src/lib/eolian/database_validate.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 4e309a52da..f065584f82 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -661,6 +661,10 @@ _db_fill_inherits(Eolian_Class *cl, Eina_Hash *fhash)
661 if (eina_hash_find(fhash, cl->base.name)) 661 if (eina_hash_find(fhash, cl->base.name))
662 return EINA_TRUE; 662 return EINA_TRUE;
663 663
664 /* already merged outside of staging, therefore validated, and skipped */
665 if (eina_hash_find(cl->base.unit->state->main.unit.classes, cl->base.name))
666 return EINA_TRUE;
667
664 Eina_List *il = cl->inherits; 668 Eina_List *il = cl->inherits;
665 Eina_Stringshare *inn = NULL; 669 Eina_Stringshare *inn = NULL;
666 cl->inherits = NULL; 670 cl->inherits = NULL;
@@ -684,16 +688,11 @@ _db_fill_inherits(Eolian_Class *cl, Eina_Hash *fhash)
684 else 688 else
685 { 689 {
686 cl->inherits = eina_list_append(cl->inherits, icl); 690 cl->inherits = eina_list_append(cl->inherits, icl);
687 /* if the inherited class is already merged outside of staging,
688 * it's ok to skip it because it's already filled and validated
689 */
690 Eolian_Class *vcl = eina_hash_find(
691 cl->base.unit->state->main.unit.classes, inn);
692 /* fill if not found, but do not return right away because 691 /* fill if not found, but do not return right away because
693 * the rest of the list needs to be freed in order not to 692 * the rest of the list needs to be freed in order not to
694 * leak any memory 693 * leak any memory
695 */ 694 */
696 if (!vcl && !_db_fill_inherits(icl, fhash)) 695 if (!_db_fill_inherits(icl, fhash))
697 succ = EINA_FALSE; 696 succ = EINA_FALSE;
698 } 697 }
699 eina_stringshare_del(inn); 698 eina_stringshare_del(inn);
@@ -866,11 +865,6 @@ database_validate(const Eolian_Unit *src)
866 Eina_Hash *fhash = eina_hash_stringshared_new(NULL); 865 Eina_Hash *fhash = eina_hash_stringshared_new(NULL);
867 EINA_ITERATOR_FOREACH(iter, cl) 866 EINA_ITERATOR_FOREACH(iter, cl)
868 { 867 {
869 /* can skip classes that have already been merged and validated */
870 Eolian_Class *vcl = eina_hash_find(
871 cl->base.unit->state->main.unit.classes, cl->base.name);
872 if (vcl)
873 continue;
874 if (!_db_fill_inherits(cl, fhash)) 868 if (!_db_fill_inherits(cl, fhash))
875 { 869 {
876 eina_hash_free(fhash); 870 eina_hash_free(fhash);