xref: /freebsd/contrib/ldns/compat/calloc.c (revision 193d9e768ba63fcfb187cfd17f461f7d41345048)
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 
25