wm: teppich

ref: 3b735b0c7ea632cc7c861cfe85b161da5cce5e36
dir: /libc/llfree.c/

View raw version
/* 
	free all entries in a linked list,
	can, and will be dangerous
*/

#include <u.h>
#include <libc.h>
#include <mem.h>

void
llfree(ll_t *head)
{
	ll_t *t, *p;
	
	p = head;
	t = (ll_t*)head->next;
	while(t != nil)
	{
		free(p);
		p = t;
		t = (ll_t*)t->next;
	}
}