1998-09-06 23:45:24 +00:00
|
|
|
#ifndef _ALLOCA_H
|
|
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
#include <stdlib/alloca.h>
|
2016-08-23 21:19:17 -04:00
|
|
|
|
|
|
|
|
# ifndef _ISOMAC
|
|
|
|
|
|
2025-08-22 11:37:00 +01:00
|
|
|
#include <elf.h>
|
1998-08-09 17:39:48 +00:00
|
|
|
|
|
|
|
|
#undef __alloca
|
|
|
|
|
|
|
|
|
|
/* Now define the internal interfaces. */
|
1999-11-23 17:22:17 +00:00
|
|
|
extern void *__alloca (size_t __size);
|
1998-08-09 17:39:48 +00:00
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
|
# define __alloca(size) __builtin_alloca (size)
|
|
|
|
|
#endif /* GCC. */
|
1998-09-06 23:45:24 +00:00
|
|
|
|
2002-10-09 09:42:48 +00:00
|
|
|
extern int __libc_use_alloca (size_t size) __attribute__ ((const));
|
|
|
|
|
extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
|
2011-01-13 14:01:56 -05:00
|
|
|
libc_hidden_proto (__libc_alloca_cutoff)
|
2002-10-09 09:42:48 +00:00
|
|
|
|
|
|
|
|
#define __MAX_ALLOCA_CUTOFF 65536
|
|
|
|
|
|
|
|
|
|
#include <allocalim.h>
|
|
|
|
|
|
2009-01-29 00:17:57 +00:00
|
|
|
#if defined stackinfo_get_sp && defined stackinfo_sub_sp
|
|
|
|
|
# define alloca_account(size, avar) \
|
2011-05-20 23:46:03 -04:00
|
|
|
({ void *old__ = stackinfo_get_sp (); \
|
|
|
|
|
void *m__ = __alloca (size); \
|
|
|
|
|
avar += stackinfo_sub_sp (old__); \
|
|
|
|
|
m__; })
|
2009-01-29 00:17:57 +00:00
|
|
|
#else
|
|
|
|
|
# define alloca_account(size, avar) \
|
2011-05-20 23:46:03 -04:00
|
|
|
({ size_t s__ = (size); \
|
|
|
|
|
avar += s__; \
|
2009-01-29 15:36:26 +00:00
|
|
|
__alloca (s__); })
|
2009-01-29 00:17:57 +00:00
|
|
|
#endif
|
|
|
|
|
|
2016-08-23 21:19:17 -04:00
|
|
|
# endif /* !_ISOMAC */
|
1998-09-06 23:45:24 +00:00
|
|
|
#endif
|