Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): remove void pointers from SuffAddSrc



details:   https://anonhg.NetBSD.org/src/rev/a96c83b8396f
branches:  trunk
changeset: 945003:a96c83b8396f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 18 15:40:54 2020 +0000

description:
make(1): remove void pointers from SuffAddSrc

diffstat:

 usr.bin/make/suff.c |  23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diffs (66 lines):

diff -r cfa8206d814b -r a96c83b8396f usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sun Oct 18 15:31:43 2020 +0000
+++ b/usr.bin/make/suff.c       Sun Oct 18 15:40:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.182 2020/10/18 15:31:43 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.183 2020/10/18 15:40:54 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.182 2020/10/18 15:31:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.183 2020/10/18 15:40:54 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -902,10 +902,8 @@
  *     lsp             list and parent for the new Src
  */
 static void
-SuffAddSrc(void *sp, void *lsp)
+SuffAddSrc(Suff *s, LstSrc *ls)
 {
-    Suff *s = (Suff *)sp;
-    LstSrc *ls = (LstSrc *)lsp;
     Src *s2;                   /* new Src structure */
     Src *targ;                 /* Target structure */
 
@@ -963,12 +961,12 @@
 static void
 SuffAddLevel(SrcList *l, Src *targ)
 {
-    LstSrc         ls;
-
-    ls.s = targ;
-    ls.l = l;
-
-    Lst_ForEach(targ->suff->children, SuffAddSrc, &ls);
+    SrcListNode *ln;
+    for (ln = targ->suff->children->first; ln != NULL; ln = ln->next) {
+       Suff *childSuff = ln->datum;
+       LstSrc ls = { l, targ };
+       SuffAddSrc(childSuff, &ls);
+    }
 }
 
 /* Free the first Src in the list that doesn't have a reference count.
@@ -977,7 +975,6 @@
 SuffRemoveSrc(SrcList *l)
 {
     SrcListNode *ln;
-    Src *s;
 
     Lst_Open(l);
 
@@ -988,7 +985,7 @@
 #endif
 
     while ((ln = Lst_Next(l)) != NULL) {
-       s = LstNode_Datum(ln);
+       Src *s = LstNode_Datum(ln);
        if (s->children == 0) {
            free(s->file);
            if (!s->parent)



Home | Main Index | Thread Index | Old Index