]> Pileus Git - ~andy/fetchmail/blobdiff - xmalloc.h
Fix typo repsonsible -> responsible.
[~andy/fetchmail] / xmalloc.h
index 690b574199af4313deb6d1c95689f309e6d5661c..3766043df0203473c303947ecbbe60dc88d49738 100644 (file)
--- a/xmalloc.h
+++ b/xmalloc.h
@@ -6,17 +6,12 @@
 #include "config.h"
 
 /* xmalloc.c */
-#if defined(HAVE_VOIDPOINTER)
-#define XMALLOCTYPE void
-#else
-#define XMALLOCTYPE char
-#endif
 
 /** Allocate \a n characters of memory, abort program on failure. */
-XMALLOCTYPE *xmalloc(size_t n);
+void *xmalloc(size_t n);
 
 /** Reallocate \a n characters of memory, abort program on failure. */
-XMALLOCTYPE *xrealloc(/*@null@*/ XMALLOCTYPE *, size_t n);
+void *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; }
@@ -25,4 +20,10 @@ XMALLOCTYPE *xrealloc(/*@null@*/ XMALLOCTYPE *, size_t n);
  * pointer, abort program on failure. */
 char *xstrdup(const char *src);
 
+/** Duplicate at most the first \a n characters from \a src to a newly
+ * malloc()d memory region and NUL-terminate it, and return its pointer, abort
+ * program on failure. The memory size is the lesser of either the string
+ * length including NUL byte or n + 1. */
+char *xstrndup(const char *src, size_t n);
+
 #endif