about summary refs log tree commit diff
path: root/src/malloc/calloc.c
blob: 436c0b034869a409cdc24d63adbd9be04ac5ff7e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdlib.h>
#include <errno.h>

void *__malloc0(size_t);

void *calloc(size_t m, size_t n)
{
	if (n && m > (size_t)-1/n) {
		errno = ENOMEM;
		return 0;
	}
	return __malloc0(n * m);
}