alloc: simplify full usage
This commit is contained in:
parent
9e5b4f0060
commit
3b7543064d
10
core/alloc.c
10
core/alloc.c
@ -217,9 +217,8 @@ static void *allocFromSlab(struct slabEntry *slab)
|
||||
if (*next == (vaddr_t)NULL) {
|
||||
pr_devel("Slab @%d is now full\n", slab);
|
||||
slab->full = 1;
|
||||
} else {
|
||||
slab->freeEl = (void *)(*next);
|
||||
}
|
||||
slab->freeEl = (void *)(*next);
|
||||
|
||||
return (void *)next;
|
||||
}
|
||||
@ -289,12 +288,7 @@ static int freeFromSlab(void *ptr, struct slabEntry *slab)
|
||||
if ((slabEntry->page <= (vaddr_t)ptr) &&
|
||||
((vaddr_t)ptr < (slabEntry->page + slabEntry->size))) {
|
||||
|
||||
if (slabEntry->full) {
|
||||
*((vaddr_t *)ptr) = (vaddr_t)NULL;
|
||||
} else {
|
||||
*((vaddr_t *)ptr) = (vaddr_t)slabEntry->freeEl;
|
||||
}
|
||||
|
||||
*((vaddr_t *)ptr) = (vaddr_t)slabEntry->freeEl;
|
||||
slabEntry->freeEl = ptr;
|
||||
slabEntry->full = 0;
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user