summaryrefslogtreecommitdiffstats
path: root/cygwin-1.7.9-strdupa.patch
diff options
context:
space:
mode:
Diffstat (limited to 'cygwin-1.7.9-strdupa.patch')
-rw-r--r--cygwin-1.7.9-strdupa.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/cygwin-1.7.9-strdupa.patch b/cygwin-1.7.9-strdupa.patch
new file mode 100644
index 0000000..d1ec29e
--- /dev/null
+++ b/cygwin-1.7.9-strdupa.patch
@@ -0,0 +1,28 @@
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/string.h,v
+retrieving revision 1.28
+retrieving revision 1.29
+diff -u -r1.28 -r1.29
+--- src/newlib/libc/include/string.h 2011/05/25 18:41:10 1.28
++++ src/newlib/libc/include/string.h 2011/06/10 18:30:38 1.29
+@@ -96,6 +96,20 @@
+ int _EXFUN(strtosigno, (const char *__name));
+ #endif
+
++#if defined _GNU_SOURCE && defined __GNUC__
++#define strdupa(__s) \
++ (__extension__ ({const char *__in = (__s); \
++ size_t __len = strlen (__in) + 1; \
++ char * __out = (char *) __builtin_alloca (__len); \
++ (char *) memcpy (__out, __in, __len);}))
++#define strndupa(__s, __n) \
++ (__extension__ ({const char *__in = (__s); \
++ size_t __len = strnlen (__in, (__n)) + 1; \
++ char *__out = (char *) __builtin_alloca (__len); \
++ __out[__len-1] = '\0'; \
++ (char *) memcpy (__out, __in, __len-1);}))
++#endif /* _GNU_SOURCE && __GNUC__ */
++
+ /* These function names are used on Windows and perhaps other systems. */
+ #ifndef strcmpi
+ #define strcmpi strcasecmp