diff options
author | gcc <gcc@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2006-08-17 01:18:26 +0000 |
---|---|---|
committer | gcc <gcc@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2006-08-17 01:18:26 +0000 |
commit | 15f34685e7a9b5caf761af2ebf6afa20438d440b (patch) | |
tree | dc04ce3cdf040f198743c15b64557824de174680 /libc/include/alloca.h | |
parent | 1e848e0e775a36f6359161f5deb890942ef42ff3 (diff) |
Import glibc-mainline for 2006-08-16
git-svn-id: svn://svn.eglibc.org/fsf/trunk@4 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/include/alloca.h')
-rw-r--r-- | libc/include/alloca.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/libc/include/alloca.h b/libc/include/alloca.h new file mode 100644 index 000000000..563d7868b --- /dev/null +++ b/libc/include/alloca.h @@ -0,0 +1,49 @@ +#ifndef _ALLOCA_H + +#include <stdlib/alloca.h> +#include <stackinfo.h> + +#undef __alloca + +/* Now define the internal interfaces. */ +extern void *__alloca (size_t __size); + +#ifdef __GNUC__ +# define __alloca(size) __builtin_alloca (size) +#endif /* GCC. */ + +extern int __libc_use_alloca (size_t size) __attribute__ ((const)); +extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const)); + +#define __MAX_ALLOCA_CUTOFF 65536 + +#include <allocalim.h> + +#if _STACK_GROWS_DOWN +# define extend_alloca(buf, len, newlen) \ + (__typeof (buf)) ({ size_t __newlen = (newlen); \ + char *__newbuf = __alloca (__newlen); \ + if (__newbuf + __newlen == (char *) buf) \ + len += __newlen; \ + else \ + len = __newlen; \ + __newbuf; }) +#elif _STACK_GROWS_UP +# define extend_alloca(buf, len, newlen) \ + (__typeof (buf)) ({ size_t __newlen = (newlen); \ + char *__newbuf = __alloca (__newlen); \ + char *__buf = (buf); \ + if (__buf + __newlen == __newbuf) \ + { \ + len += __newlen; \ + __newbuf = __buf; \ + } \ + else \ + len = __newlen; \ + __newbuf; }) +#else +# define extend_alloca(buf, len, newlen) \ + __alloca (((len) = (newlen))) +#endif + +#endif |