2 * xmalloc.c -- allocate space or die
4 * Copyright 1998 by Eric S. Raymond.
5 * For license terms, see the file COPYING in this directory.
12 #if defined(STDC_HEADERS)
15 #include "fetchmail.h"
18 #if defined(HAVE_VOIDPOINTER)
19 #define XMALLOCTYPE void
21 #define XMALLOCTYPE char
29 p = (XMALLOCTYPE *) malloc(n);
30 if (p == (XMALLOCTYPE *) 0)
31 error(PS_UNDEFINED, errno, _("malloc failed"));
36 xrealloc (XMALLOCTYPE *p, int n)
40 p = (XMALLOCTYPE *) realloc(p, n);
41 if (p == (XMALLOCTYPE *) 0)
42 error(PS_UNDEFINED, errno, _("realloc failed"));
46 char *xstrdup(const char *s)
49 p = (char *) xmalloc(strlen(s)+1);
54 /* xmalloc.c ends here */