diff options
author | Hartmut Brandt <harti@FreeBSD.org> | 2005-03-16 16:02:09 +0000 |
---|---|---|
committer | Hartmut Brandt <harti@FreeBSD.org> | 2005-03-16 16:02:09 +0000 |
commit | 0bcbcabd26ca97bfb426e5e56f90a867ee3a7793 (patch) | |
tree | 1fc067323f2fa8d745c13013ddcb9276914e127b /usr.bin | |
parent | a2384179091907dcdb9682c4371a7e52ced3d85f (diff) | |
download | src-0bcbcabd26ca97bfb426e5e56f90a867ee3a7793.tar.gz src-0bcbcabd26ca97bfb426e5e56f90a867ee3a7793.zip |
Replace Lst_ForEach by LST_FOREACH.
Notes
Notes:
svn path=/head/; revision=143703
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/compat.c | 10 | ||||
-rw-r--r-- | usr.bin/make/job.c | 45 |
2 files changed, 12 insertions, 43 deletions
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index a60f331ffaf7..2ab841622c49 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 45f0fd8bf004..13904c14043a 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); |