Merge commit '315633ecce31cd5af92112ab9903f6e7e8ae8df7'
[free-mc.git] / src / poptalloca.h
blob0c6a5d03925b1b3c3df4e241b4eced0991a5e204
1 /* Definitions for alloca (mostly extracted from AC_FUNC_ALLOCA). According
2 to the autoconf manual in dome versions of AIX the declaration of alloca
3 has to precede everything else execept comments and prepocessor directives,
4 i.e. including this file has to preceed anything else.
6 NOTE: alloca is redefined as malloc on systems which fail to support alloca.
7 Don't include this header if you frequently use alloca in order to avoid an
8 unlimited amount of memory leaks.
9 popt uses alloca only during program startup, i.e. the memory leaks caused
10 by this redefinition are limited.
13 #ifndef MC_POPTALLOCA_H
14 #define MC_POPTALLOCA_H
16 /* AIX requires this to be the first thing in the file. */
17 #ifdef __GNUC__
18 # define alloca __builtin_alloca
19 #else
20 # ifdef _MSC_VER
21 # include <malloc.h>
22 # define alloca _alloca
23 # else
24 # if HAVE_ALLOCA_H
25 # include <alloca.h>
26 # else
27 # ifdef _AIX
28 #pragma alloca
29 # else
30 # ifndef alloca /* predefined by HP cc +Olibcalls */
31 char *alloca ();
32 # endif
33 # endif
34 # endif
35 # endif
36 #endif
38 #ifndef HAVE_ALLOCA
39 # include <stdlib.h>
40 # if !defined(STDC_HEADERS) && defined(HAVE_MALLOC_H)
41 # include <malloc.h>
42 # endif
43 # define alloca malloc
44 #endif
46 #endif