realloc
=======

POSIX specification:
 http://www.opengroup.org/onlinepubs/9699919799/functions/realloc.html

Gnulib module: realloc-posix

Portability problems fixed by Gnulib:

  * Upon failure, the function does not set errno to ENOMEM on some platforms: mingw, MSVC 9.

Portability problems not fixed by Gnulib:

  * It is not portable to call realloc with a size of 0.  With a NULL pointer argument, this is the same ambiguity as malloc (0) on whether a unique zero-size object is created.  With a non-NULL pointer argument, C99 requires that if realloc (p, 0) returns NULL then p is still valid.  Among implementations that obey C99, behavior varies on whether realloc (p, 0) always fails and leaves p valid, or usually succeeds and returns a unique zero-size object; either way, a program not suspecting these semantics will leak memory (either the still-valid p, or the non-NULL return value).  Meanwhile, several implementations violate C99, by always calling free (p) but returning NULL: glibc, Cygwin

Extension: Gnulib provides a module realloc-gnu that substitutes a realloc implementation that behaves more like the glibc implementation.