alloc.c
alloc_mem
free_mem
merge
del_slot
public PHYS_CLICKS alloc_mem (PHYS_CLICKS clicks) {
struct hole *hp, *prev_ptr;
PHYS_CLICKS old_base;
hp = hole_head;
while (hp != NIL_HOLE) {
if (hp->h_len >= clicks) {
old_base = hp->h_base;
hp->h_base += clicks;
hp->h_len -= clicks;
if (hp->h_len != 0)
return old_base;
del_slot (prev_ptr, hp);
return old_base;
}
prev_ptr = hp;
hp = hp->h_next;
}
return E_NO_MEM;
}