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