alloc: fix indent

This commit is contained in:
Mathieu Maret 2019-04-16 20:11:24 +02:00
parent f3a03f3965
commit f90b9bd3fd

View File

@ -7,7 +7,6 @@
#include "mem.h"
#include "vga.h"
#define IS_SELF_CONTAINED(desc) ((vaddr_t)((desc)->page) == (vaddr_t)(desc))
// Slab will contains object from sizeof(void *) to PAGE_SIZE/2 by pow2
#define SLUB_SIZE (PAGE_SHIFT - 1)
@ -119,7 +118,7 @@ void *malloc(size_t size)
return NULL;
}
struct slabDesc *slubEntry;
uint slubIdx = 0;
uint slubIdx;
list_foreach(slub, slubEntry, slubIdx)
{
if (size <= slubEntry->size)
@ -130,7 +129,8 @@ void *malloc(size_t size)
list_foreach(slubEntry, slab, slabIdx)
{
if (!slab->full) {
pr_devel("found place in slub %d at idx %d for size %d\n", slubIdx, slabIdx, size);
pr_devel("found place in slub %d at idx %d for size %d\n", slubIdx,
slabIdx, size);
return allocFromSlab(slab);
}
}
@ -146,7 +146,8 @@ void *malloc(size_t size)
return allocFromSlab(newSlab);
}
int slabFree(void *ptr, struct slabDesc *slab){
int slabFree(void *ptr, struct slabDesc *slab)
{
struct slabDesc *slabEntry;
int slabIdx;
list_foreach(slab, slabEntry, slabIdx)
@ -162,13 +163,15 @@ int slabFree(void *ptr, struct slabDesc *slab){
}
return 0;
}
void free(void *ptr){
void free(void *ptr)
{
if (!ptr)
return;
struct slabDesc *slab;
int slabIdx;
list_foreach(slub, slab, slabIdx){
list_foreach(slub, slab, slabIdx)
{
if (slabFree(ptr, slab))
return;
}