1#ifndef _ALLOCA_H
2
3#include <stdlib/alloca.h>
4#include <stackinfo.h>
5
6#undef	__alloca
7
8/* Now define the internal interfaces.  */
9extern void *__alloca (size_t __size);
10
11#ifdef	__GNUC__
12# define __alloca(size)	__builtin_alloca (size)
13#endif /* GCC.  */
14
15extern int __libc_use_alloca (size_t size) __attribute__ ((const));
16extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
17
18#define __MAX_ALLOCA_CUTOFF	65536
19
20#include <allocalim.h>
21
22#if _STACK_GROWS_DOWN
23# define extend_alloca(buf, len, newlen) \
24  (__typeof (buf)) ({ size_t __newlen = (newlen);			      \
25		      char *__newbuf = __alloca (__newlen);		      \
26		      if (__newbuf + __newlen == (char *) buf)		      \
27			len += __newlen;				      \
28		      else						      \
29			len = __newlen;					      \
30		      __newbuf; })
31#elif _STACK_GROWS_UP
32# define extend_alloca(buf, len, newlen) \
33  (__typeof (buf)) ({ size_t __newlen = (newlen);			      \
34		      char *__newbuf = __alloca (__newlen);		      \
35		      char *__buf = (buf);				      \
36		      if (__buf + __newlen == __newbuf)			      \
37			{						      \
38			  len += __newlen;				      \
39			  __newbuf = __buf;				      \
40			}						      \
41		      else						      \
42			len = __newlen;					      \
43		      __newbuf; })
44#else
45# define extern_alloca(buf, len, newlen) \
46  __alloca (((len) = (newlen)))
47#endif
48
49#endif
50