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): inline Lst_ForEachUntil in Compat_Make



details:   https://anonhg.NetBSD.org/src/rev/894e7a15d00c
branches:  trunk
changeset: 939386:894e7a15d00c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 26 16:41:42 2020 +0000

description:
make(1): inline Lst_ForEachUntil in Compat_Make

diffstat:

 usr.bin/make/compat.c  |  40 +++++++++++++++++-----------------------
 usr.bin/make/nonints.h |   4 ++--
 2 files changed, 19 insertions(+), 25 deletions(-)

diffs (99 lines):

diff -r 3751144087b5 -r 894e7a15d00c usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sat Sep 26 16:27:27 2020 +0000
+++ b/usr.bin/make/compat.c     Sat Sep 26 16:41:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.151 2020/09/26 16:00:12 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.152 2020/09/26 16:41:42 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -99,7 +99,7 @@
 #include    "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.151 2020/09/26 16:00:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.152 2020/09/26 16:41:42 rillig Exp $");
 
 static GNode       *curTarg = NULL;
 static void CompatInterrupt(int);
@@ -471,30 +471,25 @@
     return Compat_RunCommand(cmd, gn);
 }
 
-static int
-CompatMake(void *gn, void *pgn)
+static void
+MakeNodes(GNodeList *gnodes, GNode *pgn)
 {
-    return Compat_Make(gn, pgn);
+    GNodeListNode *node;
+    for (node = gnodes->first; node != NULL; node = node->next) {
+       GNode *cohort = node->datum;
+       Compat_Make(cohort, pgn);
+    }
 }
 
-/*-
- *-----------------------------------------------------------------------
- * Compat_Make --
- *     Make a target.
+/* Make a target.
+ *
+ * If an error is detected and not being ignored, the process exits.
  *
  * Input:
- *     gnp             The node to make
- *     pgnp            Parent to abort if necessary
- *
- * Results:
- *     0
- *
- * Side Effects:
- *     If an error is detected and not being ignored, the process exits.
- *
- *-----------------------------------------------------------------------
+ *     gn              The node to make
+ *     pgn             Parent to abort if necessary
  */
-int
+void
 Compat_Make(GNode *gn, GNode *pgn)
 {
     if (!shellName)            /* we came here from jobs */
@@ -512,7 +507,7 @@
        gn->made = BEINGMADE;
        if ((gn->type & OP_MADE) == 0)
            Suff_FindDeps(gn);
-       Lst_ForEachUntil(gn->children, CompatMake, gn);
+       MakeNodes(gn->children, gn);
        if ((gn->flags & REMAKE) == 0) {
            gn->made = ABORTED;
            pgn->flags &= ~(unsigned)REMAKE;
@@ -652,8 +647,7 @@
     }
 
 cohorts:
-    Lst_ForEachUntil(gn->cohorts, CompatMake, pgn);
-    return 0;
+    MakeNodes(gn->cohorts, pgn);
 }
 
 /* Initialize this module and start making.
diff -r 3751144087b5 -r 894e7a15d00c usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Sat Sep 26 16:27:27 2020 +0000
+++ b/usr.bin/make/nonints.h    Sat Sep 26 16:41:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.130 2020/09/26 16:00:12 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.131 2020/09/26 16:41:42 rillig Exp $     */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -87,7 +87,7 @@
 /* compat.c */
 int Compat_RunCommand(char *, GNode *);
 void Compat_Run(GNodeList *);
-int Compat_Make(GNode *, GNode *);
+void Compat_Make(GNode *, GNode *);
 
 /* cond.c */
 CondEvalResult Cond_EvalCondition(const char *, Boolean *);



Home | Main Index | Thread Index | Old Index