diff options
author | harti <harti@FreeBSD.org> | 2004-12-08 17:48:15 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2004-12-08 17:48:15 +0000 |
commit | 071557e3014909bb8b910eb4e71b7efd491be2c5 (patch) | |
tree | 72dbd42f43d9214bafb8b2f2f480fed50201e78d /usr.bin/make | |
parent | 18e5f36d99f664454f7e3a997620fb7d037813e9 (diff) | |
download | FreeBSD-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.c | 16 |
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); } } |