Mercurial > hg > xemacs-beta
diff src/s/sunos4-0.h @ 551:e9a3f8b4de53
[xemacs-hg @ 2001-05-21 05:26:06 by martinb]
realloc() handling on sunos4; remove lwlib-config kludge
author | martinb |
---|---|
date | Mon, 21 May 2001 05:26:51 +0000 |
parents | 3ecd8885ac67 |
children |
line wrap: on
line diff
--- a/src/s/sunos4-0.h Mon May 21 02:15:12 2001 +0000 +++ b/src/s/sunos4-0.h Mon May 21 05:26:51 2001 +0000 @@ -110,6 +110,23 @@ int mkdir (const char *dpath, unsigned short dmode) # endif /* __GNUC__ */ +/* ANSI C requires that realloc accept a null pointer argument, + but ancient implementations such as SunOS 4 don't allow this. + We redefine realloc here so that the source code can be written to + use the ANSI C API. */ +#include <sys/types.h> +#ifdef __GNUC__ +inline /* Suppress warning: realloc_accepting_nullptr defined but not used */ +#endif +static void* +realloc_accepting_nullptr (void *ptr, size_t size) +{ + extern char *realloc (); + extern char *malloc (); + return ptr ? (void *) realloc (ptr, size) : (void *) malloc (size); +} +#define realloc(ptr, size) realloc_accepting_nullptr (ptr, size) + #endif /* C_CODE */ #endif /* _S_SUNOS4_H_ */