q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=5ca43e58c020932b8cd89b7b1641a4879243258f

commit 5ca43e58c020932b8cd89b7b1641a4879243258f
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Wed May 20 14:45:32 2015 +0100

    eolian: test for possible duplicates in deps list
---
 src/lib/eolian/eo_parser.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 774bf14..66886f6 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,
 static void
 _append_dep(Eo_Lexer *ls, const char *fname, const char *name, int line, int 
col)
 {
-   Eolian_Dependency *dep = calloc(1, sizeof(Eolian_Dependency));
+   Eina_Stringshare *cname = eina_stringshare_add(name);
+   Eolian_Dependency *dep;
+
+   Eina_List *deps = eina_hash_find(_depclasses, ls->filename);
+   Eina_List *l;
+   void *data;
+
+   /* check for possible duplicates while building the deplist */
+   EINA_LIST_FOREACH(deps, l, data)
+     if (data == cname)
+       {
+          eina_stringshare_del(cname);
+          return;
+       }
+
+   dep = calloc(1, sizeof(Eolian_Dependency));
    FILL_BASE(dep->base, ls, line, col);
    dep->filename = eina_stringshare_add(fname);
-   dep->name     = eina_stringshare_add(name);
-   eina_hash_set(_depclasses, ls->filename, eina_list_append((Eina_List*)
-       eina_hash_find(_depclasses, ls->filename), dep));
+   dep->name     = cname;
+
+   deps = eina_list_append(deps, dep);
+   eina_hash_set(_depclasses, ls->filename, deps);
 }
 
 static Eolian_Type *

-- 


Reply via email to