diff options
author | jkh <jkh@FreeBSD.org> | 1995-01-23 21:03:17 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-01-23 21:03:17 +0000 |
commit | 2dab142d474fb234edc194c7335fd5a627df77a6 (patch) | |
tree | 4fe60a8bd60f90f8461d826b8a6c0cd471c798d3 /usr.bin/make/lst.lib/lstDestroy.c | |
parent | a8745a0ec131df320b6a7be781964c129c33644f (diff) | |
download | FreeBSD-src-2dab142d474fb234edc194c7335fd5a627df77a6.zip FreeBSD-src-2dab142d474fb234edc194c7335fd5a627df77a6.tar.gz |
Bring in a number of changes from NetBSD's make, fixing quite a few
problems in the process:
1. Quoting should work properly now. In particular, Chet's reported bash
make problem has gone away.
2. A lot of memory that just wasn't being free'd after use is now freed.
This should cause make to take up a LOT less memory when dealing with
archive targets.
3. Give proper credit to Adam de Boor in a number of files.
Obtained from: NetBSD (and Adam de Boor)
Diffstat (limited to 'usr.bin/make/lst.lib/lstDestroy.c')
-rw-r--r-- | usr.bin/make/lst.lib/lstDestroy.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/usr.bin/make/lst.lib/lstDestroy.c b/usr.bin/make/lst.lib/lstDestroy.c index 3dedbf1..7b7b4b2 100644 --- a/usr.bin/make/lst.lib/lstDestroy.c +++ b/usr.bin/make/lst.lib/lstDestroy.c @@ -63,7 +63,7 @@ static char sccsid[] = "@(#)lstDestroy.c 8.1 (Berkeley) 6/6/93"; void Lst_Destroy (l, freeProc) Lst l; - register void (*freeProc)(); + register void (*freeProc) __P((ClientData)); { register ListNode ln; register ListNode tln = NilListNode; @@ -76,21 +76,25 @@ Lst_Destroy (l, freeProc) */ return; } - + + /* To ease scanning */ + if (list->lastPtr != NilListNode) + list->lastPtr->nextPtr = NilListNode; + else { + free ((Address)l); + return; + } + if (freeProc) { - for (ln = list->firstPtr; - ln != NilListNode && tln != list->firstPtr; - ln = tln) { - tln = ln->nextPtr; - (*freeProc) (ln->datum); - free ((Address)ln); + for (ln = list->firstPtr; ln != NilListNode; ln = tln) { + tln = ln->nextPtr; + (*freeProc) (ln->datum); + free ((Address)ln); } } else { - for (ln = list->firstPtr; - ln != NilListNode && tln != list->firstPtr; - ln = tln) { - tln = ln->nextPtr; - free ((Address)ln); + for (ln = list->firstPtr; ln != NilListNode; ln = tln) { + tln = ln->nextPtr; + free ((Address)ln); } } |