
# include	"llist.h"

void
ll_clear(hp)
Head_p	hp;
{	extern char *ll_freelist;
	register List_p lp;
	register List_p	lp1;

	LIST_INCR(ll_clear);
	ll_hmagic(hp);

	for (lp = hp->ll_next; lp; lp = lp1) {
		lp1 = lp->ll_next;
		if (lp->ll_elem)
			chk_free((void *) lp->ll_elem);
		vm_free((void *) lp, &ll_freelist);
		}

	hp->ll_next = hp->ll_prev = NULL;
}
