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 MakeFindChild into PretendAllCh...



details:   https://anonhg.NetBSD.org/src/rev/5ca563233588
branches:  trunk
changeset: 978057:5ca563233588
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 08 10:50:50 2020 +0000

description:
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.

diffstat:

 usr.bin/make/make.c |  35 +++++++++++------------------------
 1 files changed, 11 insertions(+), 24 deletions(-)

diffs (59 lines):

diff -r 4612ebe18e6e -r 5ca563233588 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Sun Nov 08 10:40:07 2020 +0000
+++ b/usr.bin/make/make.c       Sun Nov 08 10:50:50 2020 +0000
@@ -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 @@
     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;
+    GNodeListNode *ln;
 
-    Dir_UpdateMTime(gn, FALSE);
-    GNode_UpdateYoungestChild(pgn, gn);
-    pgn->unmade--;
+    for (ln = pgn->children->first; ln != NULL; ln = ln->next) {
+       GNode *cgn = ln->datum;
 
-    return 0;
-}
-
-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



Home | Main Index | Thread Index | Old Index