Replace Lst_ForEach by LST_FOREACH.

This commit is contained in:
Hartmut Brandt 2005-03-16 16:02:09 +00:00
parent a238417909
commit 0bcbcabd26
2 changed files with 12 additions and 43 deletions

View File

@ -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;

View File

@ -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 **);
@ -633,35 +632,6 @@ JobPrintCommand(void *cmdp, void *jobp)
return (0);
}
/*-
*-----------------------------------------------------------------------
* 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 --
@ -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);