diff options
author | harti <harti@FreeBSD.org> | 2005-02-24 10:23:31 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-02-24 10:23:31 +0000 |
commit | 7873864c5519927ba9e02a4e82894691383bf92b (patch) | |
tree | 8289804dc41f8331fab348263195d1d6e16e4420 /usr.bin | |
parent | fd75a56290a9f8f79e65c33d2539ed9e3778a0ed (diff) | |
download | FreeBSD-src-7873864c5519927ba9e02a4e82894691383bf92b.zip FreeBSD-src-7873864c5519927ba9e02a4e82894691383bf92b.tar.gz |
Replace the calls to Lst_ForEach with the new LST_FOREACH macro and
fix the prototype for Compat_RunCommand to take the actual argument
types instead of void *.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/compat.c | 30 | ||||
-rw-r--r-- | usr.bin/make/compat.h | 3 |
2 files changed, 24 insertions, 9 deletions
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index badc43c..ac225b2 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -142,6 +142,7 @@ CompatInterrupt(int signo) { GNode *gn; sigset_t nmask, omask; + LstNode *ln; sigemptyset(&nmask); sigaddset(&nmask, SIGINT); @@ -169,7 +170,10 @@ CompatInterrupt(int signo) if (signo == SIGINT) { gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE); if (gn != NULL) { - Lst_ForEach(&gn->commands, Compat_RunCommand, (void *)gn); + LST_FOREACH(ln, &gn->commands) { + if (Compat_RunCommand(Lst_Datum(ln), gn)) + break; + } } } @@ -224,7 +228,7 @@ shellneed(char *cmd) *----------------------------------------------------------------------- */ int -Compat_RunCommand(void *cmdp, void *gnp) +Compat_RunCommand(char *cmd, GNode *gn) { char *cmdStart; /* Start of expanded command */ char *cp; @@ -237,8 +241,7 @@ Compat_RunCommand(void *cmdp, void *gnp) ReturnStatus rstat; /* Status of fork */ LstNode *cmdNode; /* Node where current command is located */ char **av; /* Argument vector for thing to exec */ - char *cmd = cmdp; - GNode *gn = gnp; + char *cmd_save; /* saved cmd */ /* * Avoid clobbered variable warnings by forcing the compiler @@ -389,7 +392,7 @@ Compat_RunCommand(void *cmdp, void *gnp) */ if (!DEBUG(GRAPH2)) { free(cmdStart); - Lst_Replace(cmdNode, cmdp); + Lst_Replace(cmdNode, cmd_save); } /* @@ -466,6 +469,7 @@ CompatMake(void *gnp, void *pgnp) { GNode *gn = gnp; GNode *pgn = pgnp; + LstNode *ln; if (gn->type & OP_USE) { Make_HandleUse(gn, pgn); @@ -542,7 +546,10 @@ CompatMake(void *gnp, void *pgnp) */ if (!touchFlag) { curTarg = gn; - Lst_ForEach(&gn->commands, Compat_RunCommand, (void *)gn); + LST_FOREACH(ln, &gn->commands) { + if (Compat_RunCommand(Lst_Datum(ln), gn)) + break; + } curTarg = NULL; } else { Job_Touch(gn, gn->type & OP_SILENT); @@ -683,6 +690,7 @@ Compat_Run(Lst *targs) { GNode *gn = NULL;/* Current root target */ int errors; /* Number of targets not remade due to errors */ + LstNode *ln; CompatInit(); Shell_Init(); /* Set up shell. */ @@ -708,7 +716,10 @@ Compat_Run(Lst *targs) if (!queryFlag) { gn = Targ_FindNode(".BEGIN", TARG_NOCREATE); if (gn != NULL) { - Lst_ForEach(&gn->commands, Compat_RunCommand, gn); + LST_FOREACH(ln, &gn->commands) { + if (Compat_RunCommand(Lst_Datum(ln), gn)) + break; + } if (gn->made == ERROR) { printf("\n\nStop.\n"); exit(1); @@ -743,6 +754,9 @@ Compat_Run(Lst *targs) * If the user has defined a .END target, run its commands. */ if (errors == 0) { - Lst_ForEach(&ENDNode->commands, Compat_RunCommand, gn); + LST_FOREACH(ln, &ENDNode->commands) { + if (Compat_RunCommand(Lst_Datum(ln), gn)) + break; + } } } diff --git a/usr.bin/make/compat.h b/usr.bin/make/compat.h index 0c91789..8d21e8b 100644 --- a/usr.bin/make/compat.h +++ b/usr.bin/make/compat.h @@ -41,9 +41,10 @@ #ifndef compat_h_29e49e8c #define compat_h_29e49e8c +struct GNode; struct Lst; void Compat_Run(struct Lst *); -int Compat_RunCommand(void *, void *); +int Compat_RunCommand(char *, struct GNode *); #endif /* compat_h_29e49e8c */ |