forked from KolibriOS/kolibrios
libc.obj: Fixed calloc function
git-svn-id: svn://kolibrios.org@9189 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
329531cd24
commit
4918685b4a
@ -1,6 +1,13 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/ksys.h>
|
#include <sys/ksys.h>
|
||||||
|
|
||||||
void *calloc(size_t num, size_t size) {
|
void *calloc(size_t num, size_t size) {
|
||||||
return _ksys_alloc(num*size);
|
void *ptr = _ksys_alloc(num*size);
|
||||||
|
if(!ptr){
|
||||||
|
errno = ENOMEM;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
memset(ptr, 0, num*size);
|
||||||
|
return ptr;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user