3 #include <stdlib/alloca.h>
8 /* Now define the internal interfaces. */
9 extern void *__alloca (size_t __size);
12 # define __alloca(size) __builtin_alloca (size)
15 extern int __libc_use_alloca (size_t size) __attribute__ ((const));
16 extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
17 libc_hidden_proto (__libc_alloca_cutoff)
19 #define __MAX_ALLOCA_CUTOFF 65536
21 #include <allocalim.h>
23 #ifndef stackinfo_alloca_round
24 # define stackinfo_alloca_round(l) (((l) + 15) & -16)
28 # define extend_alloca(buf, len, newlen) \
29 (__typeof (buf)) ({ size_t __newlen = stackinfo_alloca_round (newlen); \
30 char *__newbuf = __alloca (__newlen); \
31 if (__newbuf + __newlen == (char *) buf) \
37 # define extend_alloca(buf, len, newlen) \
38 (__typeof (buf)) ({ size_t __newlen = stackinfo_alloca_round (newlen); \
39 char *__newbuf = __alloca (__newlen); \
40 char *__buf = (buf); \
41 if (__buf + len == __newbuf) \
50 # define extend_alloca(buf, len, newlen) \
51 __alloca (((len) = (newlen)))
54 #if defined stackinfo_get_sp && defined stackinfo_sub_sp
55 # define alloca_account(size, avar) \
56 ({ void *old__ = stackinfo_get_sp (); \
57 void *m__ = __alloca (size); \
58 avar += stackinfo_sub_sp (old__); \
60 # define extend_alloca_account(buf, len, newlen, avar) \
61 ({ void *old__ = stackinfo_get_sp (); \
62 void *m__ = extend_alloca (buf, len, newlen); \
63 avar += stackinfo_sub_sp (old__); \
66 # define alloca_account(size, avar) \
67 ({ size_t s__ = (size); \
70 # define extend_alloca_account(buf, len, newlen, avar) \
71 ({ size_t s__ = (newlen); \
73 extend_alloca (buf, len, s__); })