aboutsummaryrefslogtreecommitdiff
path: root/include/08.heap/heap24.c
diff options
context:
space:
mode:
authorAleksa Vučković <aleksav013@gmail.com>2022-05-30 00:10:05 +0200
committerAleksa Vučković <aleksav013@gmail.com>2022-05-30 10:22:10 +0200
commitc45a7d924b10d9cc69a48896f7a6c99ecbf56493 (patch)
tree0fd94d340c8b9bb909b048b1ba33eea69c602464 /include/08.heap/heap24.c
parentfe14916f60fe94db918a238d5d26ce2b0ed70e7e (diff)
\small u \smallsizeHEADmaster
Diffstat (limited to 'include/08.heap/heap24.c')
-rw-r--r--include/08.heap/heap24.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/08.heap/heap24.c b/include/08.heap/heap24.c
index 11a4697..221bc4f 100644
--- a/include/08.heap/heap24.c
+++ b/include/08.heap/heap24.c
@@ -1,3 +1,10 @@
- /* this error needs to be raised or reported somehow */
- return;
-}
+ /* clear allocation */
+ id = bm[bi];
+ /* oddly.. GCC did not optimize this */
+ max = b->size / b->bsize;
+ for (x = bi; bm[x] == id && x < max; ++x) bm[x] = 0;
+ /* update free block count */
+ b->used -= x - bi;
+ return;
+ }
+ }