Module Name:    src
Committed By:   rillig
Date:           Sun Nov  8 10:50:50 UTC 2020

Modified Files:
        src/usr.bin/make: make.c

Log Message:
make(1): inline MakeFindChild into PretendAllChildrenAreMade

This gets rid of a few void pointers and some function calls.  The
documentation of MakeFindChild essentially repeated what the code does,
and the redundant parts of it have been removed.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/usr.bin/make/make.c

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/make.c
diff -u src/usr.bin/make/make.c:1.198 src/usr.bin/make/make.c:1.199
--- src/usr.bin/make/make.c:1.198	Sun Nov  8 10:40:07 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 10:50:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.198 2020/11/08 10:40:07 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.199 2020/11/08 10:50:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.198 2020/11/08 10:40:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.199 2020/11/08 10:50:50 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -356,31 +356,18 @@ MakeAddChild(void *gnp, void *lp)
     return 0;
 }
 
-/* Find the pathname of a child that was already made.
- *
- * The path and mtime of the node and the youngestChild of the parent are
- * updated; the unmade children count of the parent is decremented.
- *
- * Input:
- *	gnp		the node to find
- */
-static int
-MakeFindChild(void *gnp, void *pgnp)
+static void
+PretendAllChildrenAreMade(GNode *pgn)
 {
-    GNode *gn = gnp;
-    GNode *pgn = pgnp;
-
-    Dir_UpdateMTime(gn, FALSE);
-    GNode_UpdateYoungestChild(pgn, gn);
-    pgn->unmade--;
+    GNodeListNode *ln;
 
-    return 0;
-}
+    for (ln = pgn->children->first; ln != NULL; ln = ln->next) {
+	GNode *cgn = ln->datum;
 
-static void
-PretendAllChildrenAreMade(GNode *gn)
-{
-    Lst_ForEachUntil(gn->children, MakeFindChild, gn);
+	Dir_UpdateMTime(cgn, FALSE);	/* cgn->path may get updated as well */
+	GNode_UpdateYoungestChild(pgn, cgn);
+	pgn->unmade--;
+    }
 }
 
 /* Called by Make_Run and SuffApplyTransform on the downward pass to handle

Reply via email to