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