Add zalloc
This commit is contained in:
parent
92b4f4af3a
commit
9c36f3afa2
@ -304,6 +304,15 @@ void *malloc(size_t size)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *zalloc(size_t size){
|
||||||
|
void *alloc = malloc(size);
|
||||||
|
|
||||||
|
if (alloc != NULL)
|
||||||
|
memset(alloc, 0, size);
|
||||||
|
|
||||||
|
return alloc;
|
||||||
|
}
|
||||||
|
|
||||||
static int freeFromSlab(void *ptr, struct slabEntry *slab)
|
static int freeFromSlab(void *ptr, struct slabEntry *slab)
|
||||||
{
|
{
|
||||||
struct slabEntry *slabEntry;
|
struct slabEntry *slabEntry;
|
||||||
|
@ -15,6 +15,7 @@ int allocPopulate();
|
|||||||
int allocBookSlab(size_t size, size_t sizeSlab, int selfContained);
|
int allocBookSlab(size_t size, size_t sizeSlab, int selfContained);
|
||||||
|
|
||||||
void *malloc(size_t size);
|
void *malloc(size_t size);
|
||||||
|
void *zalloc(size_t size);
|
||||||
void free(void *ptr);
|
void free(void *ptr);
|
||||||
|
|
||||||
/* Stuct definition shared for test purpose
|
/* Stuct definition shared for test purpose
|
||||||
|
Loading…
Reference in New Issue
Block a user