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