1#include <config.h>
2#undef realloc
3#undef malloc
4
5#include <stdlib.h>
6
7#include <errno.h>
8
9void * rpl_realloc (void *p, size_t n)
10{
11  void *result;
12
13  if (n == 0)
14    {
15      n = 1;
16    }
17
18  if (p == NULL)
19    {
20      result = malloc (n);
21    }
22  else
23    result = realloc (p, n);
24
25  if (result == NULL)
26    errno = ENOMEM;
27
28  return result;
29}
30