summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/job.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-03-18 15:25:23 +0000
committerharti <harti@FreeBSD.org>2005-03-18 15:25:23 +0000
commit5b2a5b84de72ec5b61bf7881edd6bc91cec70f49 (patch)
treed5a2b3fbe8e3c257925240d5efd23aa981bd11c0 /usr.bin/make/job.c
parentf7c0ee40681d2ed91c48b4f6106f71ff06195217 (diff)
downloadFreeBSD-src-5b2a5b84de72ec5b61bf7881edd6bc91cec70f49.zip
FreeBSD-src-5b2a5b84de72ec5b61bf7881edd6bc91cec70f49.tar.gz
Replace Lst_Find calls with LST_FOREACH loops. This helps in
constification und simplifies the code because the one-liner predicates can be inlined into the code.
Diffstat (limited to 'usr.bin/make/job.c')
-rw-r--r--usr.bin/make/job.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 13904c1..8bd44a7 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -421,27 +421,6 @@ JobPassSig(int signo)
/*-
*-----------------------------------------------------------------------
- * JobCmpPid --
- * Compare the pid of the job with the given pid and return 0 if they
- * are equal. This function is called from Job_CatchChildren via
- * Lst_Find to find the job descriptor of the finished job.
- *
- * Results:
- * 0 if the pid's match
- *
- * Side Effects:
- * None
- *-----------------------------------------------------------------------
- */
-static int
-JobCmpPid(const void *job, const void *pid)
-{
-
- return (*(const int *)pid - ((const Job *)job)->pid);
-}
-
-/*-
- *-----------------------------------------------------------------------
* JobPrintCommand --
* Put out another command for the given job. If the command starts
* with an @ or a - we process it specially. In the former case,
@@ -1920,11 +1899,17 @@ Job_CatchChildren(Boolean block)
break;
DEBUGF(JOB, ("Process %d exited or stopped.\n", pid));
- jnode = Lst_Find(&jobs, &pid, JobCmpPid);
+ LST_FOREACH(jnode, &jobs) {
+ if (((const Job *)Lst_Datum(jnode))->pid == pid)
+ break;
+ }
if (jnode == NULL) {
if (WIFSIGNALED(status) && (WTERMSIG(status) == SIGCONT)) {
- jnode = Lst_Find(&stoppedJobs, &pid, JobCmpPid);
+ LST_FOREACH(jnode, &stoppedJobs) {
+ if (((const Job *)Lst_Datum(jnode))->pid == pid)
+ break;
+ }
if (jnode == NULL) {
Error("Resumed child (%d) not in table", pid);
continue;
OpenPOWER on IntegriCloud