// Need to mangle these "C" functions because C++ modifies their signature.
-#define memchr __glibcpp_memchr
-#define strchr __glibcpp_strchr
+#define memcpy __glibcpp_memcpy
+#define memmove __glibcpp_memmove
+#define strcpy __glibcpp_strcpy
+#define strncpy __glibcpp_strncpy
+#define strcat __glibcpp_strcat
+#define strncat __glibcpp_strncat
+#define memcmp __glibcpp_memcmp
+#define strcmp __glibcpp_strcmp
+#define strcoll __glibcpp_strcoll
+#define strncmp __glibcpp_strncmp
+#define strxfrm __glibcpp_strxfrm
+#define memchr __glibcpp_memchr
+#define strchr __glibcpp_strchr
+#define strcspn __glibcpp_strcspn
#define strpbrk __glibcpp_strpbrk
#define strrchr __glibcpp_strrchr
-#define strstr __glibcpp_strstr
+#define strspn __glibcpp_strspn
+#define strstr __glibcpp_strstr
+#define strtok __glibcpp_strtok
+#define memset __glibcpp_memset
+#define strerror __glibcpp_strerror
+#define strlen __glibcpp_strlen
#pragma GCC system_header
#include <string.h>
namespace std
{
- extern "C" void* memcpy(void*, const void*, size_t);
+ inline void*
+ memcpy(void* __p1, const void* __p2, size_t __n)
+ { return __builtin_memcpy(__p1, __p2, __n); }
+
extern "C" void* memmove(void*, const void*, size_t);
- extern "C" char* strcpy(char*, const char*);
- extern "C" char* strncpy(char*, const char*, size_t);
- extern "C" char* strcat(char*, const char*);
- extern "C" char* strncat(char*, const char*, size_t);
- extern "C" int memcmp(const void*, const void*, size_t);
- extern "C" int strcmp(const char*, const char*);
+
+ inline char*
+ strcpy(char* __s1, const char* __s2)
+ { return __builtin_strcpy(__s1, __s2); }
+
+ inline char*
+ strncpy(char* __s1, const char* __s2, size_t __n)
+ { return __builtin_strncpy(__s1, __s2, __n); }
+
+ inline char*
+ strcat(char* __s1, const char* __s2)
+ { return __builtin_strcat(__s1, __s2); }
+
+ inline char*
+ strncat(char* __s1, const char* __s2, size_t __n)
+ { return __builtin_strncat(__s1, __s2, __n); }
+
+ inline int
+ memcmp(const void* __p1, const void* __p2, size_t __n)
+ { return __builtin_memcmp(__p1, __p2, __n); }
+
+ inline int
+ strcmp(const char* __s1, const char* __s2)
+ { return __builtin_strcmp(__s1, __s2); }
+
extern "C" int strcoll(const char*, const char*);
- extern "C" int strncmp(const char*, const char*, size_t);
+
+ inline int
+ strncmp(const char* __s1, const char* __s2, size_t __n)
+ { return __builtin_strncmp(__s1, __s2, __n); }
+
extern "C" size_t strxfrm(char*, const char*, size_t);
extern "C" const void* memchr(const void*, int, size_t);
+
inline void*
memchr(void* __p, int __c, size_t __n)
{
return const_cast<void*>(memchr(const_cast<const void*>(__p), __c, __n));
}
- extern "C" const char* strchr(const char*, int);
+
+ inline const char*
+ strchr(const char* __s1, int __n)
+ { return const_cast<const char*>(__builtin_strchr(__s1, __n)); }
+
inline char*
strchr(char* __s1, int __n)
{
- return const_cast<char*>(strchr(const_cast<const char*>(__s1), __n));
+ return
+ const_cast<char*>(__builtin_strchr(const_cast<const char*>(__s1), __n));
}
- extern "C" size_t strcspn(const char*, const char*);
- extern "C" const char* strpbrk(const char*, const char*);
+
+ inline size_t
+ strcspn(const char* __s1, const char* __s2)
+ { return __builtin_strcspn(__s1, __s2); }
+
+ inline const char*
+ strpbrk(const char* __s1, const char* __s2)
+ { return const_cast<char*>(__builtin_strpbrk(__s1, __s2)); }
+
inline char*
strpbrk(char* __s1, const char* __s2)
{
- return const_cast<char*>(strpbrk(const_cast<const char*>(__s1), __s2));
+ return const_cast<char*>
+ (__builtin_strpbrk(const_cast<const char*>(__s1), __s2));
}
- extern "C" const char* strrchr(const char*, int);
+
+ inline const char*
+ strrchr(const char* __s1, int __n)
+ { return const_cast<char*>(__builtin_strrchr(__s1, __n)); }
+
inline char*
strrchr(char* __s1, int __n)
- {
- return const_cast<char*>(strrchr(const_cast<const char*>(__s1), __n));
- }
- extern "C" size_t strspn(const char*, const char*);
- extern "C" const char* strstr(const char*, const char*);
+ { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }
+
+ inline size_t
+ strspn(const char* __s1, const char* __s2)
+ { return __builtin_strspn(__s1, __s2); }
+
+ inline const char*
+ strstr(const char* __s1, const char* __s2)
+ { return const_cast<char*>(__builtin_strstr (__s1, __s2)); }
+
inline char*
strstr(char* __s1, const char* __s2)
{
- return const_cast<char*>(strstr(const_cast<const char*>(__s1), __s2));
+ return (const_cast<char*>
+ (__builtin_strstr(const_cast<const char*>(__s1), __s2)));
}
+
extern "C" char* strtok(char*, const char*);
- extern "C" void* memset(void*, int, size_t);
+
+ inline void*
+ memset(void* __p, int __c, size_t __n)
+ { return __builtin_memset(__p, __c, __n); }
+
extern "C" char* strerror(int);
- extern "C" size_t strlen(const char*);
+
+ inline size_t
+ strlen(const char* __s)
+ { return __builtin_strlen(__s); }
}
#endif