ref: fb7157467a0a0308e92072d64494aab213b927b2
parent: 9bd2c2d1765c8a63cdaddfa1590e03a1572659f1
author: mkf <mkf@cloud9p.org>
date: Tue Dec 5 16:24:42 EST 2023
free: return void, move to libc.h
--- /dev/null
+++ b/libc/free.c
@@ -1,0 +1,16 @@
+#include <u.h>
+#include <mem.h>
+
+void
+free(void *mem)
+{
+ int i;
+
+ i = (((int)(mem) - MEM_BEG ) / BLOCKSIZE)+1;
+ while(memap[i])
+ {
+ memap[i] = 0;
+ *(char*)mem++ = '\0';
+ i++;
+ }
+}