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>
24 # define extend_alloca(buf, len, newlen) \
25 (__typeof (buf)) ({ size_t __newlen = (newlen); \
26 char *__newbuf = __alloca (__newlen); \
27 if (__newbuf + __newlen == (char *) buf) \
33 # define extend_alloca(buf, len, newlen) \
34 (__typeof (buf)) ({ size_t __newlen = (newlen); \
35 char *__newbuf = __alloca (__newlen); \
36 char *__buf = (buf); \
37 if (__buf + __newlen == __newbuf) \
46 # define extend_alloca(buf, len, newlen) \
47 __alloca (((len) = (newlen)))
50 #if defined stackinfo_get_sp && defined stackinfo_sub_sp
51 # define alloca_account(size, avar) \
52 ({ void *old__ = stackinfo_get_sp (); \
53 void *m__ = __alloca (size); \
54 avar += stackinfo_sub_sp (old__); \
56 # define extend_alloca_account(buf, len, newlen, avar) \
57 ({ void *old__ = stackinfo_get_sp (); \
58 void *m__ = extend_alloca (buf, len, newlen); \
59 avar += stackinfo_sub_sp (old__); \
62 # define alloca_account(size, avar) \
63 ({ size_t s__ = (size); \
66 # define extend_alloca_account(buf, len, newlen, avar) \
67 ({ size_t s__ = (newlen); \
69 extend_alloca (buf, len, s__); })