diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-02-16 20:22:38 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-02-16 20:22:38 +0000 |
commit | c6b9747e0493e77bebb50082ced2bae877bc4aea (patch) | |
tree | 36f3e95aa9a7e4e9e24f5da6cb1f0b13d0a61035 /winsup/cygwin/malloc_wrapper.cc | |
parent | de5c20c2deec25e448745a4baccc27517924108b (diff) | |
download | cygnal-c6b9747e0493e77bebb50082ced2bae877bc4aea.tar.gz cygnal-c6b9747e0493e77bebb50082ced2bae877bc4aea.tar.bz2 cygnal-c6b9747e0493e77bebb50082ced2bae877bc4aea.zip |
* 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.cc | 11 |
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) { |