diff options
Diffstat (limited to 'xmalloc.h')
-rw-r--r-- | xmalloc.h | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -4,9 +4,14 @@ #define XMALLOC_H #include "config.h" +#include <stdlib.h> + +#ifdef __cplusplus +extern "C" { +#endif /* xmalloc.c */ -#if defined(HAVE_VOIDPOINTER) +#if defined(HAVE_VOIDPOINTER) || defined(__cplusplus) #define XMALLOCTYPE void #else #define XMALLOCTYPE char @@ -16,7 +21,7 @@ XMALLOCTYPE *xmalloc(size_t n); /** Reallocate \a n characters of memory, abort program on failure. */ -XMALLOCTYPE *xrealloc(/*@null@*/ XMALLOCTYPE *, size_t n); +XMALLOCTYPE *xrealloc(/*@null@*/ void *, size_t n); /** Free memory at position \a p and set pointer \a p to NULL afterwards. */ #define xfree(p) { if (p) { free(p); } (p) = 0; } @@ -31,4 +36,8 @@ char *xstrdup(const char *src); * length including NUL byte or n + 1. */ char *xstrndup(const char *src, size_t n); +#ifdef __cplusplus +} +#endif + #endif |