summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-03-16 16:02:09 +0000
committerharti <harti@FreeBSD.org>2005-03-16 16:02:09 +0000
commitdf4f9cb09a9b495d4414f941dd34e968e222b42f (patch)
tree1fc067323f2fa8d745c13013ddcb9276914e127b
parentcbbd172aea353aba1c2f9a966c3dee5f0151d015 (diff)
downloadFreeBSD-src-df4f9cb09a9b495d4414f941dd34e968e222b42f.zip
FreeBSD-src-df4f9cb09a9b495d4414f941dd34e968e222b42f.tar.gz
Replace Lst_ForEach by LST_FOREACH.
-rw-r--r--usr.bin/make/compat.c10
-rw-r--r--usr.bin/make/job.c45
2 files changed, 12 insertions, 43 deletions
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index a60f331..2ab8416 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -451,19 +451,14 @@ Compat_RunCommand(char *cmd, GNode *gn)
* CompatMake --
* Make a target, given the parent, to abort if necessary.
*
- * Results:
- * 0
- *
* Side Effects:
* If an error is detected and not being ignored, the process exits.
*
*-----------------------------------------------------------------------
*/
static int
-CompatMake(void *gnp, void *pgnp)
+CompatMake(GNode *gn, GNode *pgn)
{
- GNode *gn = gnp;
- GNode *pgn = pgnp;
LstNode *ln;
if (gn->type & OP_USE) {
@@ -481,7 +476,8 @@ CompatMake(void *gnp, void *pgnp)
gn->make = TRUE;
gn->made = BEINGMADE;
Suff_FindDeps(gn);
- Lst_ForEach(&gn->children, CompatMake, gn);
+ LST_FOREACH(ln, &gn->children)
+ CompatMake(Lst_Datum(ln), gn);
if (!gn->make) {
gn->made = ABORTED;
pgn->make = FALSE;
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 45f0fd8..13904c1 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -297,7 +297,6 @@ static sig_atomic_t interrupted;
static void JobPassSig(int);
static int JobPrintCommand(void *, void *);
-static int JobSaveCommand(void *, void *);
static void JobClose(Job *);
static void JobFinish(Job *, int *);
static void JobExec(Job *, char **);
@@ -635,35 +634,6 @@ JobPrintCommand(void *cmdp, void *jobp)
/*-
*-----------------------------------------------------------------------
- * JobSaveCommand --
- * Save a command to be executed when everything else is done.
- * Callback function for JobFinish...
- *
- * Results:
- * Always returns 0
- *
- * Side Effects:
- * The command is tacked onto the end of postCommands's commands list.
- *
- *-----------------------------------------------------------------------
- */
-static int
-JobSaveCommand(void *cmd, void *gn)
-{
- Buffer *buf;
- char *str;
-
- buf = Var_Subst(NULL, cmd, gn, FALSE);
- str = Buf_GetAll(buf, NULL);
- Buf_Destroy(buf, FALSE);
-
- Lst_AtEnd(&postCommands->commands, str);
- return (0);
-}
-
-
-/*-
- *-----------------------------------------------------------------------
* JobClose --
* Called to close both input and output pipes when a job is finished.
*
@@ -722,6 +692,7 @@ static void
JobFinish(Job *job, int *status)
{
Boolean done;
+ LstNode *ln;
if ((WIFEXITED(*status) &&
(((WEXITSTATUS(*status) != 0) && !(job->flags & JOB_IGNERR)))) ||
@@ -906,10 +877,11 @@ JobFinish(Job *job, int *status)
* the parents. In addition, any saved commands for the node are placed
* on the .END target.
*/
- if (job->tailCmds != NULL) {
- Lst_ForEachFrom(&job->node->commands, job->tailCmds,
- JobSaveCommand, job->node);
+ for (ln = job->tailCmds; ln != NULL; ln = LST_NEXT(ln)) {
+ Lst_AtEnd(&postCommands->commands,
+ Buf_Peel(Var_Subst(NULL, Lst_Datum(ln), job->node, FALSE)));
}
+
job->node->made = MADE;
Make_Update(job->node);
free(job);
@@ -1584,9 +1556,10 @@ JobStart(GNode *gn, int flags, Job *previous)
*/
if (cmdsOK) {
if (aborting == 0) {
- if (job->tailCmds != NULL) {
- Lst_ForEachFrom(&job->node->commands, job->tailCmds,
- JobSaveCommand, job->node);
+ for (ln = job->tailCmds; ln != NULL; ln = LST_NEXT(ln)) {
+ Lst_AtEnd(&postCommands->commands,
+ Buf_Peel(Var_Subst(NULL, Lst_Datum(ln), job->node,
+ FALSE)));
}
job->node->made = MADE;
Make_Update(job->node);
OpenPOWER on IntegriCloud