summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>1999-12-18 21:56:08 +0000
committerMarc Espie <espie@cvs.openbsd.org>1999-12-18 21:56:08 +0000
commit1054102ac1e5da024bb0316738d7cef7f996d28b (patch)
tree9c44d109f83a08cfeda71f32710eeff5a752bef9 /usr.bin
parent55cf72374a6a0695c5f50929233d06baccf648f7 (diff)
Lst_DeQueue already checks for empty lists.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/arch.c7
-rw-r--r--usr.bin/make/compat.c7
-rw-r--r--usr.bin/make/dir.c10
-rw-r--r--usr.bin/make/job.c10
-rw-r--r--usr.bin/make/make.c10
-rw-r--r--usr.bin/make/parse.c23
-rw-r--r--usr.bin/make/suff.c20
7 files changed, 35 insertions, 52 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c
index 9aaba2c1710..428e7f0e0fc 100644
--- a/usr.bin/make/arch.c
+++ b/usr.bin/make/arch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arch.c,v 1.20 1999/12/18 21:53:32 espie Exp $ */
+/* $OpenBSD: arch.c,v 1.21 1999/12/18 21:56:07 espie Exp $ */
/* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
#else
-static char rcsid[] = "$OpenBSD: arch.c,v 1.20 1999/12/18 21:53:32 espie Exp $";
+static char rcsid[] = "$OpenBSD: arch.c,v 1.21 1999/12/18 21:56:07 espie Exp $";
#endif
#endif /* not lint */
@@ -363,8 +363,7 @@ Arch_ParseArchive (linePtr, nodeLst, ctxt)
char *member;
Dir_Expand(memName, dirSearchPath, members);
- while (!Lst_IsEmpty(members)) {
- member = (char *)Lst_DeQueue(members);
+ while ((member = (char *)Lst_DeQueue(members)) != NULL) {
sprintf(nameBuf, "%s(%s)", libName, member);
free(member);
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index fafea24a7cc..9f7fc77119b 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat.c,v 1.18 1999/12/18 21:53:32 espie Exp $ */
+/* $OpenBSD: compat.c,v 1.19 1999/12/18 21:56:07 espie Exp $ */
/* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: compat.c,v 1.18 1999/12/18 21:53:32 espie Exp $";
+static char rcsid[] = "$OpenBSD: compat.c,v 1.19 1999/12/18 21:56:07 espie Exp $";
#endif
#endif /* not lint */
@@ -711,8 +711,7 @@ Compat_Run(targs)
* could not be made due to errors.
*/
errors = 0;
- while (!Lst_IsEmpty (targs)) {
- gn = (GNode *) Lst_DeQueue (targs);
+ while ((gn = (GNode *)Lst_DeQueue(targs)) != NULL) {
CompatMake (gn, gn);
if (gn->made == UPTODATE) {
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index 5c98dd91c45..3e2b5812338 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.11 1999/12/18 21:53:32 espie Exp $ */
+/* $OpenBSD: dir.c,v 1.12 1999/12/18 21:56:07 espie Exp $ */
/* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else
-static char rcsid[] = "$OpenBSD: dir.c,v 1.11 1999/12/18 21:53:32 espie Exp $";
+static char rcsid[] = "$OpenBSD: dir.c,v 1.12 1999/12/18 21:56:07 espie Exp $";
#endif
#endif /* not lint */
@@ -1228,10 +1228,8 @@ Dir_ClearPath(path)
Lst path; /* Path to clear */
{
Path *p;
- while (!Lst_IsEmpty(path)) {
- p = (Path *)Lst_DeQueue(path);
- Dir_Destroy((ClientData) p);
- }
+ while ((p = (Path *)Lst_DeQueue(path)) != NULL)
+ Dir_Destroy((ClientData)p);
}
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 7362f787d00..5a2d118fadb 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: job.c,v 1.18 1999/12/18 21:53:32 espie Exp $ */
+/* $OpenBSD: job.c,v 1.19 1999/12/18 21:56:07 espie Exp $ */
/* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: job.c,v 1.18 1999/12/18 21:53:32 espie Exp $";
+static char rcsid[] = "$OpenBSD: job.c,v 1.19 1999/12/18 21:56:07 espie Exp $";
#endif
#endif /* not lint */
@@ -3148,12 +3148,14 @@ JobFlagForMigration(hostID)
static void
JobRestartJobs()
{
- while (!jobFull && !Lst_IsEmpty(stoppedJobs)) {
+ Job *job;
+
+ while (!jobFull && (job = (Job *)Lst_DeQueue(stoppedJobs)) != NULL) {
if (DEBUG(JOB)) {
(void) fprintf(stdout,
"Job queue is not full. Restarting a stopped job.\n");
(void) fflush(stdout);
}
- JobRestart((Job *)Lst_DeQueue(stoppedJobs));
+ JobRestart(job);
}
}
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index d017fb34855..7d2e1fdcee5 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: make.c,v 1.10 1999/12/18 21:53:32 espie Exp $ */
+/* $OpenBSD: make.c,v 1.11 1999/12/18 21:56:07 espie Exp $ */
/* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: make.c,v 1.10 1999/12/18 21:53:32 espie Exp $";
+static char rcsid[] = "$OpenBSD: make.c,v 1.11 1999/12/18 21:56:07 espie Exp $";
#endif
#endif /* not lint */
@@ -673,8 +673,7 @@ MakeStartJobs ()
{
register GNode *gn;
- while (!Job_Full() && !Lst_IsEmpty (toBeMade)) {
- gn = (GNode *) Lst_DeQueue (toBeMade);
+ while (!Job_Full() && (gn = (GNode *)Lst_DeQueue(toBeMade)) != NULL) {
if (DEBUG(MAKE)) {
printf ("Examining %s...", gn->name);
}
@@ -835,8 +834,7 @@ Make_Run (targs)
* be looked at in a minute, otherwise we add its children to our queue
* and go on about our business.
*/
- while (!Lst_IsEmpty (examine)) {
- gn = (GNode *) Lst_DeQueue (examine);
+ while ((gn = (GNode *)Lst_DeQueue(examine)) != NULL) {
if (!gn->make) {
gn->make = TRUE;
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 4cb4c53ba5c..d94b1b39d67 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.33 1999/12/18 21:53:32 espie Exp $ */
+/* $OpenBSD: parse.c,v 1.34 1999/12/18 21:56:07 espie Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: parse.c,v 1.33 1999/12/18 21:53:32 espie Exp $";
+static char rcsid[] = "$OpenBSD: parse.c,v 1.34 1999/12/18 21:56:07 espie Exp $";
#endif
#endif /* not lint */
@@ -1009,6 +1009,8 @@ ParseDoDependency (line)
* the end of the targets list
*/
if ((specType == Not) && (*line != '\0')) {
+ char *targName;
+
if (Dir_HasWildcards(line)) {
/*
* Targets are to be sought only in the current directory,
@@ -1029,9 +1031,7 @@ ParseDoDependency (line)
(void)Lst_AtEnd(curTargs, (ClientData)line);
}
- while(!Lst_IsEmpty(curTargs)) {
- char *targName = (char *)Lst_DeQueue(curTargs);
-
+ while((targName = (char *)Lst_DeQueue(curTargs)) != NULL) {
if (!Suff_IsTransform (targName)) {
gn = Targ_FindNode (targName, TARG_CREATE);
} else {
@@ -1273,10 +1273,8 @@ ParseDoDependency (line)
return;
}
- while (!Lst_IsEmpty (sources)) {
- gn = (GNode *) Lst_DeQueue (sources);
- ParseDoSrc (tOp, gn->name, curSrcs);
- }
+ while ((gn = (GNode *)Lst_DeQueue(sources)) != NULL)
+ ParseDoSrc(tOp, gn->name, curSrcs);
Lst_Destroy (sources, NOFREE);
cp = line;
} else {
@@ -2028,11 +2026,8 @@ ParseEOF (opened)
{
IFile *ifile; /* the state on the top of the includes stack */
- if (Lst_IsEmpty (includes)) {
- return (DONE);
- }
-
- ifile = (IFile *) Lst_DeQueue (includes);
+ if ((ifile = (IFile *)Lst_DeQueue(includes)) == NULL)
+ return DONE;
free ((Address) fname);
fname = ifile->fname;
lineno = ifile->lineno;
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index 1d0d788e9c6..e6e941e4376 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: suff.c,v 1.18 1999/12/18 21:53:33 espie Exp $ */
+/* $OpenBSD: suff.c,v 1.19 1999/12/18 21:56:07 espie Exp $ */
/* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
#else
-static char rcsid[] = "$OpenBSD: suff.c,v 1.18 1999/12/18 21:53:33 espie Exp $";
+static char rcsid[] = "$OpenBSD: suff.c,v 1.19 1999/12/18 21:56:07 espie Exp $";
#endif
#endif /* not lint */
@@ -1180,9 +1180,7 @@ SuffFindThem (srcs, slst)
rs = (Src *) NULL;
- while (!Lst_IsEmpty (srcs)) {
- s = (Src *) Lst_DeQueue (srcs);
-
+ while ((s = (Src *)Lst_DeQueue(srcs)) != NULL) {
if (DEBUG(SUFF)) {
printf ("\ttrying %s...", s->file);
}
@@ -1444,9 +1442,7 @@ SuffExpandChildren(cgnp, pgnp)
/*
* Add all elements of the members list to the parent node.
*/
- while(!Lst_IsEmpty(members)) {
- gn = (GNode *)Lst_DeQueue(members);
-
+ while((gn = (GNode *)Lst_DeQueue(members)) != NULL) {
if (DEBUG(SUFF)) {
printf("%s...", gn->name);
}
@@ -1512,12 +1508,8 @@ SuffExpandChildren(cgnp, pgnp)
exp = Lst_Init();
Dir_Expand(cgn->name, path, exp);
- while (!Lst_IsEmpty(exp)) {
- /*
- * Fetch next expansion off the list and find its GNode
- */
- cp = (char *)Lst_DeQueue(exp);
-
+ /* Fetch next expansion off the list and find its GNode. */
+ while ((cp = (char *)Lst_DeQueue(exp)) != NULL) {
if (DEBUG(SUFF)) {
printf("%s...", cp);
}