aboutsummaryrefslogtreecommitdiffstats
path: root/xalloca.c
blob: 812b551418a59a7fd911702cb2cf605ac34165de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * xalloca.c -- allocate space or die 
 *
 * For license terms, see the file COPYING in this directory.
 */

#include "config.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
#if defined(STDC_HEADERS)
#include  <stdlib.h>
#endif
#if defined(HAVE_ALLOCA_H)
#include <alloca.h>
#else
#ifdef _AIX
 #pragma alloca
#endif
#endif

#include "fetchmail.h"

#if defined(HAVE_VOIDPOINTER)
#define XALLOCATYPE void
#else
#define XALLOCATYPE char
#endif

XALLOCATYPE *
#ifdef __STDC__
xalloca (size_t n)
#else
xalloca (n)

int n;
#endif
{
    XALLOCATYPE *p;

    p = (XALLOCATYPE *) alloca(n);
    if (p == (XALLOCATYPE *) 0)
    {
	report(stderr, GT_("alloca failed\n"));
	exit(PS_UNDEFINED);
    }
    return(p);
}

/* xalloca.c ends here */