summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-20 14:45:32 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-20 14:46:01 +0100
commit5ca43e58c020932b8cd89b7b1641a4879243258f (patch)
treed1941b64f71eef63190fd6e4522496bef9dcc483
parent6efbfe227aaaa24eda7bcb7df916d4daf0a74400 (diff)
eolian: test for possible duplicates in deps list
-rw-r--r--src/lib/eolian/eo_parser.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 774bf146fa..66886f6ced 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -685,12 +685,28 @@ parse_struct_attrs(Eo_Lexer *ls, Eina_Bool is_enum, Eina_Bool *is_extern,
685static void 685static void
686_append_dep(Eo_Lexer *ls, const char *fname, const char *name, int line, int col) 686_append_dep(Eo_Lexer *ls, const char *fname, const char *name, int line, int col)
687{ 687{
688 Eolian_Dependency *dep = calloc(1, sizeof(Eolian_Dependency)); 688 Eina_Stringshare *cname = eina_stringshare_add(name);
689 Eolian_Dependency *dep;
690
691 Eina_List *deps = eina_hash_find(_depclasses, ls->filename);
692 Eina_List *l;
693 void *data;
694
695 /* check for possible duplicates while building the deplist */
696 EINA_LIST_FOREACH(deps, l, data)
697 if (data == cname)
698 {
699 eina_stringshare_del(cname);
700 return;
701 }
702
703 dep = calloc(1, sizeof(Eolian_Dependency));
689 FILL_BASE(dep->base, ls, line, col); 704 FILL_BASE(dep->base, ls, line, col);
690 dep->filename = eina_stringshare_add(fname); 705 dep->filename = eina_stringshare_add(fname);
691 dep->name = eina_stringshare_add(name); 706 dep->name = cname;
692 eina_hash_set(_depclasses, ls->filename, eina_list_append((Eina_List*) 707
693 eina_hash_find(_depclasses, ls->filename), dep)); 708 deps = eina_list_append(deps, dep);
709 eina_hash_set(_depclasses, ls->filename, deps);
694} 710}
695 711
696static Eolian_Type * 712static Eolian_Type *