Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-02-16 23:22:38 +0300
committerCorinna Vinschen <corinna@vinschen.de>2009-02-16 23:22:38 +0300
commitc6b9747e0493e77bebb50082ced2bae877bc4aea (patch)
tree36f3e95aa9a7e4e9e24f5da6cb1f0b13d0a61035 /winsup/cygwin/malloc_wrapper.cc
parentde5c20c2deec25e448745a4baccc27517924108b (diff)
* 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.
Diffstat (limited to 'winsup/cygwin/malloc_wrapper.cc')
-rw-r--r--winsup/cygwin/malloc_wrapper.cc11
1 files changed, 11 insertions, 0 deletions
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)
{