(__mempcpy, __stpncpy, __rawmemchr, __strcasecmp): Add libc_hidden_proto.
[kopensolaris-gnu/glibc.git] / include / string.h
index 7d268ec..d2062c7 100644 (file)
@@ -47,4 +47,21 @@ extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
 /* Now the real definitions.  We do this here since some of the functions
    above are defined as macros in the headers.  */
 #include <string/string.h>
+
+/* Alternative version which doesn't pollute glibc's namespace.  */
+#undef strndupa
+#define strndupa(s, n)                                                       \
+  (__extension__                                                             \
+    ({                                                                       \
+      __const char *__old = (s);                                             \
+      size_t __len = __strnlen (__old, (n));                                 \
+      char *__new = (char *) __builtin_alloca (__len + 1);                   \
+      __new[__len] = '\0';                                                   \
+      (char *) memcpy (__new, __old, __len);                                 \
+    }))
 #endif
+
+libc_hidden_proto (__mempcpy)
+libc_hidden_proto (__stpncpy)
+libc_hidden_proto (__rawmemchr)
+libc_hidden_proto (__strcasecmp)