malllloc
This commit is contained in:
parent
140635eb5f
commit
fc088b2fa0
1 changed files with 10 additions and 1 deletions
11
src/malloc.c
11
src/malloc.c
|
@ -24,7 +24,16 @@ void *malloc(size_t size)
|
|||
{
|
||||
curr = prev->next;
|
||||
if (curr->units >= nunits)
|
||||
prev->next = curr->next;
|
||||
{
|
||||
if (curr->units == nunits)
|
||||
prev->next = curr->next;
|
||||
else
|
||||
{
|
||||
curr->units -= nunits;
|
||||
curr += curr->units;
|
||||
curr->units = nunits;
|
||||
}
|
||||
}
|
||||
prev = curr;
|
||||
curr = curr->next;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue