kolibrios/programs/develop/ktcc/trunk/libc.obj/source/stdlib/calloc.c
turbocat cde4fa851d libc.obj:
- Formatted by clang-format (WebKit-style).
- Removed unnecessary errno linux. 
- Added KOS error codes. 
- String functions have been replaced with more optimal ones for x86. 
- Changed wrappers for 70 sysfunction.

git-svn-id: svn://kolibrios.org@9765 a494cfbc-eb01-0410-851d-a64ba20cac60
2022-04-15 09:00:55 +00:00

15 lines
262 B
C

#include <errno.h>
#include <stdlib.h>
#include <sys/ksys.h>
void* calloc(size_t num, size_t size)
{
void* ptr = _ksys_alloc(num * size);
if (!ptr) {
__errno = ENOMEM;
return NULL;
}
memset(ptr, 0, num * size);
return ptr;
}