svn commit: trunk/uClibc/include
vapier at uclibc.org
vapier at uclibc.org
Thu Jan 5 23:48:50 UTC 2006
Author: vapier
Date: 2006-01-05 15:48:49 -0800 (Thu, 05 Jan 2006)
New Revision: 13106
Log:
import the extend_alloca() macro from glibc
Modified:
trunk/uClibc/include/libc-internal.h
Changeset:
Modified: trunk/uClibc/include/libc-internal.h
===================================================================
--- trunk/uClibc/include/libc-internal.h 2006-01-05 23:47:53 UTC (rev 13105)
+++ trunk/uClibc/include/libc-internal.h 2006-01-05 23:48:49 UTC (rev 13106)
@@ -322,6 +322,36 @@
#define fopen64 __fopen64
#endif
+/* #include <alloca.h> */
+#include <bits/stackinfo.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
+# warning unknown stack
+# define extend_alloca(buf, len, newlen) \
+ alloca (((len) = (newlen)))
+#endif
+
/* #include <stdlib.h> */
extern char *__getenv (__const char *__name) attribute_hidden;
extern void __exit (int __status) __THROW __attribute__ ((__noreturn__)) attribute_hidden;
More information about the uClibc-cvs
mailing list