wm: teppich

Download patch

ref: 5bb11ec674b1d8ea7693a5f9120280f1102c5796
parent: 75b1fcc9cf71fa5e72ac5030ac8815c7e6be674e
author: mkf <mkf@cloud9p.org>
date: Tue Nov 28 02:30:41 EST 2023

libc/llfree: free all entries in a linked list

--- /dev/null
+++ b/libc/llfree.c
@@ -1,0 +1,23 @@
+/* 
+	free all entries in a linked list,
+	can, and will be dangrous
+*/
+
+#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*)head->next;
+	}
+}