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