2021-09-13 21:02:24 +02:00
|
|
|
#include <errno.h>
|
2022-04-15 11:00:55 +02:00
|
|
|
#include <stdlib.h>
|
2021-04-27 18:33:31 +02:00
|
|
|
#include <sys/ksys.h>
|
|
|
|
|
2022-04-15 11:00:55 +02:00
|
|
|
void* calloc(size_t num, size_t size)
|
|
|
|
{
|
|
|
|
void* ptr = _ksys_alloc(num * size);
|
|
|
|
if (!ptr) {
|
|
|
|
__errno = ENOMEM;
|
2021-09-13 21:02:24 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2022-04-15 11:00:55 +02:00
|
|
|
memset(ptr, 0, num * size);
|
2021-09-13 21:02:24 +02:00
|
|
|
return ptr;
|
|
|
|
}
|