shithub: mc

Download patch

ref: c40815889c460edd815ead46f1593510e0c56147
parent: 08b1eacc62abb4f77fd7403c692cdc4b84c7dd76
author: Ori Bernstein <[email protected]>
date: Thu Oct 4 10:52:01 EDT 2012

Filter duplicate libraries.

--- a/myrbuild/myrbuild.c
+++ b/myrbuild/myrbuild.c
@@ -154,6 +154,16 @@
     *ndeps = i;
 }
 
+int inlist(char **list, size_t sz, char *str)
+{
+    size_t i;
+
+    for (i = 0; i < sz; i++)
+        if (!strcmp(list[i], str))
+            return 1;
+    return 0;
+}
+
 void compile(char *file)
 {
     size_t i, ndeps;
@@ -171,7 +181,7 @@
                 localdep = fromuse(deps[i]);
                 compile(localdep);
                 free(localdep);
-            } else {
+            } else if (!inlist(libs, nlibs, deps[i])) {
                 lappend(&libs, &nlibs, deps[i]);
             }
         }