summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2004-12-08 17:48:15 +0000
committerharti <harti@FreeBSD.org>2004-12-08 17:48:15 +0000
commit071557e3014909bb8b910eb4e71b7efd491be2c5 (patch)
tree72dbd42f43d9214bafb8b2f2f480fed50201e78d /usr.bin/make
parent18e5f36d99f664454f7e3a997620fb7d037813e9 (diff)
downloadFreeBSD-src-071557e3014909bb8b910eb4e71b7efd491be2c5.zip
FreeBSD-src-071557e3014909bb8b910eb4e71b7efd491be2c5.tar.gz
Now that circular lists are gone remove stuff for them. Simplify
somewhat so that we can remove a local variable.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/lst.lib/lstDestroy.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/usr.bin/make/lst.lib/lstDestroy.c b/usr.bin/make/lst.lib/lstDestroy.c
index d243071..15bac2d 100644
--- a/usr.bin/make/lst.lib/lstDestroy.c
+++ b/usr.bin/make/lst.lib/lstDestroy.c
@@ -68,7 +68,6 @@ void
Lst_Destroy(Lst *list, FreeProc *freeProc)
{
LstNode *ln;
- LstNode *tln;
if (!Lst_Valid(list)) {
/*
@@ -78,22 +77,19 @@ Lst_Destroy(Lst *list, FreeProc *freeProc)
return;
}
- if (list->lastPtr == NULL) {
+ if (list->firstPtr == NULL) {
free(list);
return;
}
- /* To ease scanning */
- list->lastPtr->nextPtr = NULL;
-
- if (freeProc) {
- for (ln = list->firstPtr; ln != NULL; ln = tln) {
- tln = ln->nextPtr;
+ if (freeProc != NOFREE) {
+ while ((ln = list->firstPtr) != NULL) {
+ list->firstPtr = ln->nextPtr;
(*freeProc)(ln->datum);
free(ln);
}
} else {
- for (ln = list->firstPtr; ln != NULL; ln = tln) {
- tln = ln->nextPtr;
+ while ((ln = list->firstPtr) != NULL) {
+ list->firstPtr = ln->nextPtr;
free(ln);
}
}
OpenPOWER on IntegriCloud