musl/src/malloc/calloc.c

14 lines
192 B
C
Raw Normal View History

2011-02-12 00:22:29 -05:00
#include <stdlib.h>
#include <errno.h>
void *__malloc0(size_t);
2011-02-12 00:22:29 -05:00
void *calloc(size_t m, size_t n)
{
if (n && m > (size_t)-1/n) {
errno = ENOMEM;
return 0;
}
return __malloc0(n * m);
2011-02-12 00:22:29 -05:00
}