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/make/job.c | |
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/make/job.c')
-rw-r--r-- | usr.bin/make/job.c | 45 |
1 files changed, 9 insertions, 36 deletions
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); |