* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)lstDestroy.c 8.1 (Berkeley) %G%";
* Nuke a list and all its resources
*-----------------------------------------------------------------------
* Destroy a list and free all its resources. If the freeProc is
* given, it is called with the datum from each node in turn before
* The given list is freed in its entirety.
*-----------------------------------------------------------------------
Lst_Destroy (l
, freeProc
)
register void (*freeProc
)();
register ListNode tln
= NilListNode
;
register List list
= (List
)l
;
if (l
== NILLST
|| ! l
) {
* Note the check for l == (Lst)0 to catch uninitialized static Lst's.
for (ln
= list
->firstPtr
;
ln
!= NilListNode
&& tln
!= list
->firstPtr
;
for (ln
= list
->firstPtr
;
ln
!= NilListNode
&& tln
!= list
->firstPtr
;