1 #ifndef _STRING_H 2 #define _STRING_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 #include <features.h> 9 10 #ifdef __cplusplus 11 #define NULL 0L 12 #else 13 #define NULL ((void*)0) 14 #endif 15 16 #define __NEED_size_t 17 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ 18 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ 19 || defined(_BSD_SOURCE) 20 #define __NEED_locale_t 21 #endif 22 23 #include <bits/alltypes.h> 24 25 void *memcpy (void *__restrict, const void *__restrict, size_t); 26 void *memmove (void *, const void *, size_t); 27 void *memset (void *, int, size_t); 28 int memcmp (const void *, const void *, size_t); 29 void *memchr (const void *, int, size_t); 30 31 char *strcpy (char *__restrict, const char *__restrict); 32 char *strncpy (char *__restrict, const char *__restrict, size_t); 33 34 char *strcat (char *__restrict, const char *__restrict); 35 char *strncat (char *__restrict, const char *__restrict, size_t); 36 37 int strcmp (const char *, const char *); 38 int strncmp (const char *, const char *, size_t); 39 40 int strcoll (const char *, const char *); 41 size_t strxfrm (char *__restrict, const char *__restrict, size_t); 42 43 char *strchr (const char *, int); 44 char *strrchr (const char *, int); 45 46 size_t strcspn (const char *, const char *); 47 size_t strspn (const char *, const char *); 48 char *strpbrk (const char *, const char *); 49 char *strstr (const char *, const char *); 50 char *strtok (char *__restrict, const char *__restrict); 51 52 size_t strlen (const char *); 53 54 char *strerror (int); 55 56 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) 57 #include <strings.h> 58 #endif 59 60 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ 61 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ 62 || defined(_BSD_SOURCE) 63 char *strtok_r (char *__restrict, const char *__restrict, char **__restrict); 64 int strerror_r (int, char *, size_t); 65 char *stpcpy(char *__restrict, const char *__restrict); 66 char *stpncpy(char *__restrict, const char *__restrict, size_t); 67 size_t strnlen (const char *, size_t); 68 char *strdup (const char *); 69 char *strndup (const char *, size_t); 70 char *strsignal(int); 71 char *strerror_l (int, locale_t); 72 int strcoll_l (const char *, const char *, locale_t); 73 size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t); 74 #endif 75 76 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ 77 || defined(_BSD_SOURCE) 78 void *memccpy (void *__restrict, const void *__restrict, int, size_t); 79 #endif 80 81 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 82 char *strsep(char **, const char *); 83 size_t strlcat (char *, const char *, size_t); 84 size_t strlcpy (char *, const char *, size_t); 85 void explicit_bzero (void *, size_t); 86 #endif 87 88 #ifdef _GNU_SOURCE 89 #define strdupa(x) strcpy(alloca(strlen(x)+1),x) 90 int strverscmp (const char *, const char *); 91 char *strchrnul(const char *, int); 92 char *strcasestr(const char *, const char *); 93 void *memmem(const void *, size_t, const void *, size_t); 94 void *memrchr(const void *, int, size_t); 95 void *mempcpy(void *, const void *, size_t); 96 #ifndef __cplusplus 97 char *basename(void); 98 #endif 99 #endif 100 101 #ifdef LOSCFG_KERNEL_LMS 102 void *__memset (void *, int, size_t); 103 void *__memcpy (void *__restrict, const void *__restrict, size_t); 104 void *__memmove (void *, const void *, size_t); 105 char *__strcat (char *__restrict, const char *__restrict); 106 char *__strncat (char *__restrict, const char *__restrict, size_t); 107 char *__strcpy (char *__restrict, const char *__restrict); 108 char *__strncpy (char *__restrict, const char *__restrict, size_t); 109 110 #if defined(__has_feature) /* clang */ 111 112 #if !__has_feature(address_sanitizer) 113 #define memset(s, c, n) __memset(s, c, n) 114 #define memcpy(dst, src, len) __memcpy(dst, src, len) 115 #define memmove(dst, src, len) __memmove(dst, src, len) 116 #define strcat(dst, src) __strcat(dst, src) 117 #define strcpy(dst, src) __strcpy(dst, src) 118 #define strncat(dst, src, n) __strncat(dst, src, n) 119 #define strncpy(dst, src, n) __strncpy(dst, src, n) 120 #endif 121 122 #else /* gcc */ 123 #if !defined(__SANITIZE_ADDRESS__) 124 #define memset(s, c, n) __memset(s, c, n) 125 #define memcpy(dst, src, len) __memcpy(dst, src, len) 126 #define memmove(dst, src, len) __memmove(dst, src, len) 127 #define strcat(dst, src) __strcat(dst, src) 128 #define strcpy(dst, src) __strcpy(dst, src) 129 #define strncat(dst, src, n) __strncat(dst, src, n) 130 #define strncpy(dst, src, n) __strncpy(dst, src, n) 131 #endif 132 #endif /* __has_feature */ 133 134 #endif /* LOSCFG_KERNEL_LMS */ 135 136 #ifdef __cplusplus 137 } 138 #endif 139 140 #endif