From c6b9747e0493e77bebb50082ced2bae877bc4aea Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 16 Feb 2009 20:22:38 +0000 Subject: * cygwin.din: Export reallocf. * malloc_wrapper.cc( reallocf): New function. * posix.sgml: Add reallocf to BSD section. * include/cygwin/version.h: Bump API minor number. * libc/fts.c: Remove erroneous reallocf definition. --- winsup/cygwin/malloc_wrapper.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'winsup/cygwin/malloc_wrapper.cc') diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc index 48a82beca..86b74d564 100644 --- a/winsup/cygwin/malloc_wrapper.cc +++ b/winsup/cygwin/malloc_wrapper.cc @@ -84,6 +84,17 @@ realloc (void *p, size_t size) return res; } +/* BSD extension: Same as realloc, just if it fails to allocate new memory, + it frees the incoming pointer. */ +extern "C" void * +reallocf (void *p, size_t size) +{ + void *res = realloc (p, size); + if (!res && p) + free (p); + return res; +} + extern "C" void * calloc (size_t nmemb, size_t size) { -- cgit v1.2.3