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)
32 report(stderr, GT_("malloc failed\n"));
39 xrealloc (XMALLOCTYPE *p, int n)
43 p = (XMALLOCTYPE *) realloc(p, n);
44 if (p == (XMALLOCTYPE *) 0)
46 report(stderr, GT_("realloc failed\n"));
52 char *xstrdup(const char *s)
55 p = (char *) xmalloc(strlen(s)+1);
60 #if !defined(HAVE_STRDUP)
61 char *strdup(const char *s)
64 p = (char *) malloc(strlen(s)+1);
68 #endif /* !HAVE_STRDUP */
70 /* xmalloc.c ends here */