| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1 | // -*- C++ -*- | 
|  | 2 | //===--------------------------- cstring ----------------------------------===// | 
|  | 3 | // | 
| Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 5 | // | 
|  | 6 | // This file is distributed under the University of Illinois Open Source | 
|  | 7 | // License. See LICENSE.TXT for details. | 
|  | 8 | // | 
|  | 9 | //===----------------------------------------------------------------------===// | 
|  | 10 |  | 
|  | 11 | #ifndef _LIBCPP_CSTRING | 
|  | 12 | #define _LIBCPP_CSTRING | 
|  | 13 |  | 
|  | 14 | /* | 
|  | 15 | cstring synopsis | 
|  | 16 |  | 
|  | 17 | Macros: | 
|  | 18 |  | 
|  | 19 | NULL | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 20 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 21 | namespace std | 
|  | 22 | { | 
|  | 23 |  | 
|  | 24 | Types: | 
|  | 25 |  | 
|  | 26 | size_t | 
|  | 27 |  | 
|  | 28 | void* memcpy(void* restrict s1, const void* restrict s2, size_t n); | 
|  | 29 | void* memmove(void* s1, const void* s2, size_t n); | 
|  | 30 | char* strcpy (char* restrict s1, const char* restrict s2); | 
|  | 31 | char* strncpy(char* restrict s1, const char* restrict s2, size_t n); | 
|  | 32 | char* strcat (char* restrict s1, const char* restrict s2); | 
|  | 33 | char* strncat(char* restrict s1, const char* restrict s2, size_t n); | 
|  | 34 | int memcmp(const void* s1, const void* s2, size_t n); | 
|  | 35 | int strcmp (const char* s1, const char* s2); | 
|  | 36 | int strncmp(const char* s1, const char* s2, size_t n); | 
|  | 37 | int strcoll(const char* s1, const char* s2); | 
|  | 38 | size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n); | 
|  | 39 | const void* memchr(const void* s, int c, size_t n); | 
|  | 40 | void* memchr( void* s, int c, size_t n); | 
|  | 41 | const char* strchr(const char* s, int c); | 
|  | 42 | char* strchr( char* s, int c); | 
|  | 43 | size_t strcspn(const char* s1, const char* s2); | 
|  | 44 | const char* strpbrk(const char* s1, const char* s2); | 
|  | 45 | char* strpbrk( char* s1, const char* s2); | 
|  | 46 | const char* strrchr(const char* s, int c); | 
|  | 47 | char* strrchr( char* s, int c); | 
|  | 48 | size_t strspn(const char* s1, const char* s2); | 
|  | 49 | const char* strstr(const char* s1, const char* s2); | 
|  | 50 | char* strstr( char* s1, const char* s2); | 
|  | 51 | char* strtok(char* restrict s1, const char* restrict s2); | 
|  | 52 | void* memset(void* s, int c, size_t n); | 
|  | 53 | char* strerror(int errnum); | 
|  | 54 | size_t strlen(const char* s); | 
|  | 55 |  | 
|  | 56 | } // std | 
|  | 57 |  | 
|  | 58 | */ | 
|  | 59 |  | 
|  | 60 | #include <__config> | 
|  | 61 | #include <string.h> | 
|  | 62 |  | 
| Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 | [diff] [blame] | 63 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 64 | #pragma GCC system_header | 
| Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 | [diff] [blame] | 65 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 66 |  | 
|  | 67 | _LIBCPP_BEGIN_NAMESPACE_STD | 
|  | 68 |  | 
|  | 69 | using ::size_t; | 
| Marshall Clow | b957bac | 2015-06-02 22:26:29 | [diff] [blame] | 70 | using ::memcpy; | 
|  | 71 | using ::memmove; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 72 | using ::strcpy; | 
|  | 73 | using ::strncpy; | 
|  | 74 | using ::strcat; | 
|  | 75 | using ::strncat; | 
| Marshall Clow | b957bac | 2015-06-02 22:26:29 | [diff] [blame] | 76 | using ::memcmp; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 77 | using ::strcmp; | 
| Marshall Clow | b957bac | 2015-06-02 22:26:29 | [diff] [blame] | 78 | using ::strncmp; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 79 | using ::strcoll; | 
|  | 80 | using ::strxfrm; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 81 | using ::strcspn; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 82 | using ::strspn; | 
| Ed Schouten | 323ade3 | 2015-06-24 08:44:38 | [diff] [blame] | 83 | #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 84 | using ::strtok; | 
| Ed Schouten | 323ade3 | 2015-06-24 08:44:38 | [diff] [blame] | 85 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 86 | using ::memset; | 
|  | 87 | using ::strerror; | 
|  | 88 | using ::strlen; | 
|  | 89 |  | 
| Richard Smith | 9f4f08d | 2015-10-10 01:25:31 | [diff] [blame] | 90 | // MSVCRT, GNU libc and its derivates already have the correct prototype in | 
|  | 91 | // <string.h> if __cplusplus is defined. This macro can be defined by users if | 
|  | 92 | // their C library provides the right signature. | 
|  | 93 | #if defined(__GLIBC__) || defined(_LIBCPP_MSVCRT) || defined(__sun__) || \ | 
|  | 94 | defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_) | 
|  | 95 | #define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS | 
|  | 96 | #endif | 
|  | 97 |  | 
|  | 98 | #ifdef _LIBCPP_STRING_H_HAS_CONST_OVERLOADS | 
|  | 99 | using ::strchr; | 
|  | 100 | using ::strpbrk; | 
|  | 101 | using ::strrchr; | 
|  | 102 | using ::memchr; | 
|  | 103 | using ::strstr; | 
|  | 104 | #else | 
|  | 105 | inline _LIBCPP_INLINE_VISIBILITY const char* strchr(const char* __s, int __c) {return ::strchr(__s, __c);} | 
|  | 106 | inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);} | 
|  | 107 | inline _LIBCPP_INLINE_VISIBILITY const char* strpbrk(const char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);} | 
|  | 108 | inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);} | 
|  | 109 | inline _LIBCPP_INLINE_VISIBILITY const char* strrchr(const char* __s, int __c) {return ::strrchr(__s, __c);} | 
|  | 110 | inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);} | 
|  | 111 | inline _LIBCPP_INLINE_VISIBILITY const void* memchr(const void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);} | 
|  | 112 | inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);} | 
|  | 113 | inline _LIBCPP_INLINE_VISIBILITY const char* strstr(const char* __s1, const char* __s2) {return ::strstr(__s1, __s2);} | 
|  | 114 | inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);} | 
|  | 115 | #endif | 
|  | 116 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 117 | _LIBCPP_END_NAMESPACE_STD | 
|  | 118 |  | 
|  | 119 | #endif // _LIBCPP_CSTRING |