Module Name:    src
Committed By:   rillig
Date:           Sat Sep 26 16:41:42 UTC 2020

Modified Files:
        src/usr.bin/make: compat.c nonints.h

Log Message:
make(1): inline Lst_ForEachUntil in Compat_Make


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/usr.bin/make/compat.c
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/make/nonints.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.151 src/usr.bin/make/compat.c:1.152
--- src/usr.bin/make/compat.c:1.151	Sat Sep 26 16:00:12 2020
+++ src/usr.bin/make/compat.c	Sat Sep 26 16:41:42 2020
@@ -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 @@ CompatRunCommand(void *cmd, void *gn)
     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.
- *
- * Input:
- *	gnp		The node to make
- *	pgnp		Parent to abort if necessary
+/* Make a target.
  *
- * Results:
- *	0
- *
- * Side Effects:
- *	If an error is detected and not being ignored, the process exits.
+ * If an error is detected and not being ignored, the process exits.
  *
- *-----------------------------------------------------------------------
+ * Input:
+ *	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 @@ Compat_Make(GNode *gn, GNode *pgn)
 	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 @@ Compat_Make(GNode *gn, GNode *pgn)
     }
 
 cohorts:
-    Lst_ForEachUntil(gn->cohorts, CompatMake, pgn);
-    return 0;
+    MakeNodes(gn->cohorts, pgn);
 }
 
 /* Initialize this module and start making.

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.130 src/usr.bin/make/nonints.h:1.131
--- src/usr.bin/make/nonints.h:1.130	Sat Sep 26 16:00:12 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 26 16:41:42 2020
@@ -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 @@ Boolean Arch_IsLib(GNode *);
 /* 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 *);

Reply via email to