blob: c080c7b3da8ecdb1289a7423ece6f0264cdbb38c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#include <stdlib.h>
#include <string.h>
void *
calloc(size_t n, size_t s)
{
void *v;
if(n > 1 && ((size_t)-1)/n < s)
return 0;
n *= s;
if(v = malloc(n))
memset(v, 0, n);
return v;
}
|