]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/ldns/compat/calloc.c
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / contrib / ldns / compat / calloc.c
1 /* Just a replacement, if the original malloc is not
2    GNU-compliant. See autoconf documentation. */
3
4 #if HAVE_CONFIG_H
5 #include <ldns/config.h>
6 #endif
7
8 void *calloc();
9
10 #if !HAVE_BZERO && HAVE_MEMSET
11 # define bzero(buf, bytes)      ((void) memset (buf, 0, bytes))
12 #endif
13
14 void *
15 calloc(size_t num, size_t size)
16 {
17         void *new = malloc(num * size);
18         if (!new) {
19                 return NULL;
20         }
21         bzero(new, num * size);
22         return new;
23 }
24