]> Pileus Git - ~andy/fetchmail/blob - xmalloc.c
b5d03f89c1444d7de83a26d99add65e9c99a2ad5
[~andy/fetchmail] / xmalloc.c
1 /* Copyright 1993-95 by Carl Harris, Jr. Copyright 1996 by Eric S. Raymond
2  * All rights reserved.
3  * For license terms, see the file COPYING in this directory.
4  */
5
6 /***********************************************************************
7   module:       xmalloc.c
8   project:      fetchmail
9   programmer:   Carl Harris, ceharris@mal.com
10   description:  malloc wrapper.
11
12  ***********************************************************************/
13
14
15 #include <config.h>
16 #include <stdio.h>
17 #include <sys/types.h>
18 #include "fetchmail.h"
19
20 #if defined(HAVE_VOIDPOINTER)
21 #define XMALLOCTYPE void
22 #else
23 #define XMALLOCTYPE char
24 #endif
25
26 XMALLOCTYPE *
27 xmalloc (n)
28 size_t n;
29 {
30   XMALLOCTYPE *p;
31
32   p = (XMALLOCTYPE *) malloc(n);
33   if (p == (XMALLOCTYPE *) 0) {
34     fputs("malloc failed\n",stderr);
35     exit(PS_UNDEFINED);
36   }
37   return(p);
38 }