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.
This commit is contained in:
rillig 2020-11-08 10:50:50 +00:00
parent 9eaa257adc
commit 3f36fd563f
1 changed files with 12 additions and 25 deletions

View File

@ -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 * Copyright (c) 1988, 1989, 1990, 1993
@ -108,7 +108,7 @@
#include "job.h" #include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ /* "@(#)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. */ /* Sequence # to detect recursion. */
static unsigned int checked = 1; static unsigned int checked = 1;
@ -356,31 +356,18 @@ MakeAddChild(void *gnp, void *lp)
return 0; 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)
{
GNode *gn = gnp;
GNode *pgn = pgnp;
Dir_UpdateMTime(gn, FALSE);
GNode_UpdateYoungestChild(pgn, gn);
pgn->unmade--;
return 0;
}
static void static void
PretendAllChildrenAreMade(GNode *gn) PretendAllChildrenAreMade(GNode *pgn)
{ {
Lst_ForEachUntil(gn->children, MakeFindChild, gn); GNodeListNode *ln;
for (ln = pgn->children->first; ln != NULL; ln = ln->next) {
GNode *cgn = ln->datum;
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 /* Called by Make_Run and SuffApplyTransform on the downward pass to handle