xref: /freebsd/contrib/unbound/compat/malloc.c (revision a03411e84728e9b267056fd31c7d1d9d1dc1b01e)
1 /* Just a replacement, if the original malloc is not
2    GNU-compliant. See autoconf documentation. */
3 
4 #include "config.h"
5 #undef malloc
6 #include <sys/types.h>
7 
8 #ifndef USE_WINSOCK
9 void *malloc ();
10 #else
11 /* provide a prototype */
12 void *malloc (size_t n);
13 #endif
14 
15 /* Allocate an N-byte block of memory from the heap.
16    If N is zero, allocate a 1-byte block.  */
17 
18 void *
19 rpl_malloc_unbound (size_t n)
20 {
21   if (n == 0)
22     n = 1;
23   return malloc (n);
24 }
25