2 * xmalloc.c -- allocate space or die
4 * For license terms, see the file COPYING in this directory.
11 #if defined(STDC_HEADERS)
14 #include "fetchmail.h"
16 #if defined(HAVE_VOIDPOINTER)
17 #define XMALLOCTYPE void
19 #define XMALLOCTYPE char
27 p = (XMALLOCTYPE *) malloc(n);
28 if (p == (XMALLOCTYPE *) 0)
29 error(PS_UNDEFINED, errno, "malloc failed");
34 xrealloc (XMALLOCTYPE *p, int n)
38 p = (XMALLOCTYPE *) realloc(p, n);
39 if (p == (XMALLOCTYPE *) 0)
40 error(PS_UNDEFINED, errno, "realloc failed");
44 char *xstrdup(const char *s)
47 p = (char *) xmalloc(strlen(s)+1);
52 /* xmalloc.c ends here */