Commit ce3e94f3 authored by legoyb's avatar legoyb
Browse files

Buddy has gone too far (2)

parent be387750
......@@ -108,7 +108,11 @@ void efree_medium(Alloc a) {
if (head == buddy)
{
// Remove from List
*(void**) previous_head = *(void**) head;
printf("Previous: %p\n", previous_head); //DEBUG
if (previous_head != NULL)
*(void**) previous_head = *(void**) head;
else arena.TZL[index] = *(void**) head;
printf("Head: %p\n", head); //DEBUG
// Add new Block
void* target_head = ((unsigned long)ptr < (unsigned long)buddy) ? ptr : buddy;
*(void**) target_head = arena.TZL[index + 1];
......@@ -116,7 +120,7 @@ void efree_medium(Alloc a) {
// Recursive Call
Alloc next = a;
next.size <<= 1;
next.ptr = target_head;
next.ptr = (target_head + 16);
efree_medium(next);
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment