add oneway calloc
This commit is contained in:
parent
93e470eb80
commit
764e0027f1
@ -13,6 +13,7 @@
|
||||
|
||||
void *_malloc(size_t size);
|
||||
void *_realloc(void *ptr, size_t size);
|
||||
void *_calloc(int size, size_t cnt);
|
||||
void _free(void *ptr);
|
||||
|
||||
/** @} */
|
||||
|
||||
@ -47,6 +47,15 @@ void *_realloc(void *ptr, size_t size)
|
||||
return newptr;
|
||||
}
|
||||
|
||||
void *_calloc(int size, size_t cnt)
|
||||
{
|
||||
void *mem = _malloc(size * cnt);
|
||||
if (mem) {
|
||||
memset(mem, 0, size * cnt);
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
|
||||
void _free(void *ptr)
|
||||
{
|
||||
/* who cares about pointers? */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user