| 1 | #ifndef _STRING_H | 
|---|
| 2 |  | 
|---|
| 3 | #ifndef _ISOMAC | 
|---|
| 4 | /* Some of these are defined as macros in the real string.h, so we must | 
|---|
| 5 | prototype them before including it.  */ | 
|---|
| 6 | #include <sys/types.h> | 
|---|
| 7 | #include <locale.h> | 
|---|
| 8 |  | 
|---|
| 9 | extern void *__memccpy (void *__dest, const void *__src, | 
|---|
| 10 | int __c, size_t __n); | 
|---|
| 11 |  | 
|---|
| 12 | extern size_t __strnlen (const char *__string, size_t __maxlen) | 
|---|
| 13 | __attribute_pure__; | 
|---|
| 14 |  | 
|---|
| 15 | extern char *__strsep (char **__stringp, const char *__delim); | 
|---|
| 16 | libc_hidden_proto (__strsep) | 
|---|
| 17 |  | 
|---|
| 18 | extern int __strverscmp (const char *__s1, const char *__s2) | 
|---|
| 19 | __attribute_pure__; | 
|---|
| 20 |  | 
|---|
| 21 | extern int __strncasecmp (const char *__s1, const char *__s2, | 
|---|
| 22 | size_t __n) | 
|---|
| 23 | __attribute_pure__; | 
|---|
| 24 |  | 
|---|
| 25 | extern int __strcasecmp (const char *__s1, const char *__s2) | 
|---|
| 26 | __attribute_pure__; | 
|---|
| 27 |  | 
|---|
| 28 | extern char *__strcasestr (const char *__haystack, const char *__needle) | 
|---|
| 29 | __attribute_pure__; | 
|---|
| 30 |  | 
|---|
| 31 | extern char *__strdup (const char *__string) | 
|---|
| 32 | __attribute_malloc__; | 
|---|
| 33 | extern char *__strndup (const char *__string, size_t __n) | 
|---|
| 34 | __attribute_malloc__; | 
|---|
| 35 |  | 
|---|
| 36 | extern void *__rawmemchr (const void *__s, int __c) | 
|---|
| 37 | __attribute_pure__; | 
|---|
| 38 |  | 
|---|
| 39 | extern char *__strchrnul (const char *__s, int __c) | 
|---|
| 40 | __attribute_pure__; | 
|---|
| 41 |  | 
|---|
| 42 | extern void *__memrchr (const void *__s, int __c, size_t __n) | 
|---|
| 43 | __attribute_pure__; | 
|---|
| 44 |  | 
|---|
| 45 | extern void *__memchr (const void *__s, int __c, size_t __n) | 
|---|
| 46 | __attribute_pure__; | 
|---|
| 47 |  | 
|---|
| 48 | extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1)); | 
|---|
| 49 |  | 
|---|
| 50 | extern int __ffs (int __i) __attribute__ ((const)); | 
|---|
| 51 |  | 
|---|
| 52 | extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen); | 
|---|
| 53 |  | 
|---|
| 54 | extern char *__strerror_l (int __errnum, locale_t __loc); | 
|---|
| 55 |  | 
|---|
| 56 | extern const char *__sigdescr_np (int __errnum); | 
|---|
| 57 | libc_hidden_proto (__sigdescr_np) | 
|---|
| 58 |  | 
|---|
| 59 | /* Get _STRING_ARCH_unaligned.  */ | 
|---|
| 60 | #include <string_private.h> | 
|---|
| 61 | #endif | 
|---|
| 62 |  | 
|---|
| 63 | #include <string/string.h> | 
|---|
| 64 |  | 
|---|
| 65 | #ifndef _ISOMAC | 
|---|
| 66 | extern __typeof (strcoll_l) __strcoll_l; | 
|---|
| 67 | extern __typeof (strxfrm_l) __strxfrm_l; | 
|---|
| 68 | extern __typeof (strcasecmp_l) __strcasecmp_l; | 
|---|
| 69 | extern __typeof (strncasecmp_l) __strncasecmp_l; | 
|---|
| 70 |  | 
|---|
| 71 | /* Alternative version which doesn't pollute glibc's namespace.  */ | 
|---|
| 72 | #if IS_IN (libc) | 
|---|
| 73 | # undef strndupa | 
|---|
| 74 | # define strndupa(s, n)							      \ | 
|---|
| 75 | (__extension__							      \ | 
|---|
| 76 | ({									      \ | 
|---|
| 77 | const char *__old = (s);						      \ | 
|---|
| 78 | size_t __len = __strnlen (__old, (n));				      \ | 
|---|
| 79 | char *__new = (char *) __builtin_alloca (__len + 1);		      \ | 
|---|
| 80 | __new[__len] = '\0';						      \ | 
|---|
| 81 | (char *) memcpy (__new, __old, __len);				      \ | 
|---|
| 82 | })) | 
|---|
| 83 | #endif | 
|---|
| 84 |  | 
|---|
| 85 | libc_hidden_proto (__mempcpy) | 
|---|
| 86 | #ifndef __NO_STRING_INLINES | 
|---|
| 87 | # define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n) | 
|---|
| 88 | #endif | 
|---|
| 89 | libc_hidden_proto (__stpcpy) | 
|---|
| 90 | #ifndef __NO_STRING_INLINES | 
|---|
| 91 | # define __stpcpy(dest, src) __builtin_stpcpy (dest, src) | 
|---|
| 92 | #endif | 
|---|
| 93 | libc_hidden_proto (__stpncpy) | 
|---|
| 94 | libc_hidden_proto (__rawmemchr) | 
|---|
| 95 | libc_hidden_proto (__strcasecmp) | 
|---|
| 96 | libc_hidden_proto (__strcasecmp_l) | 
|---|
| 97 | libc_hidden_proto (__strncasecmp_l) | 
|---|
| 98 | extern __typeof (strncat) __strncat; | 
|---|
| 99 | libc_hidden_proto (__strncat) | 
|---|
| 100 | libc_hidden_proto (__strdup) | 
|---|
| 101 | libc_hidden_proto (__strndup) | 
|---|
| 102 | libc_hidden_proto (__strerror_r) | 
|---|
| 103 | libc_hidden_proto (__strverscmp) | 
|---|
| 104 | libc_hidden_proto (basename) | 
|---|
| 105 | extern char *__basename (const char *__filename) __THROW __nonnull ((1)); | 
|---|
| 106 | libc_hidden_proto (__basename) | 
|---|
| 107 | libc_hidden_proto (strcoll) | 
|---|
| 108 | libc_hidden_proto (__strcoll_l) | 
|---|
| 109 | libc_hidden_proto (__strxfrm_l) | 
|---|
| 110 | libc_hidden_proto (__strtok_r) | 
|---|
| 111 | extern char *__strsep_g (char **__stringp, const char *__delim); | 
|---|
| 112 | libc_hidden_proto (__strsep_g) | 
|---|
| 113 | libc_hidden_proto (strnlen) | 
|---|
| 114 | libc_hidden_proto (__strnlen) | 
|---|
| 115 | libc_hidden_proto (memmem) | 
|---|
| 116 | extern __typeof (memmem) __memmem; | 
|---|
| 117 | libc_hidden_proto (__memmem) | 
|---|
| 118 | libc_hidden_proto (__ffs) | 
|---|
| 119 | libc_hidden_proto (__strerror_l) | 
|---|
| 120 |  | 
|---|
| 121 | #if IS_IN (libc) | 
|---|
| 122 | /* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk.  */ | 
|---|
| 123 | void __explicit_bzero_chk_internal (void *, size_t, size_t) | 
|---|
| 124 | __THROW __nonnull ((1)) attribute_hidden; | 
|---|
| 125 | # define explicit_bzero(buf, len) \ | 
|---|
| 126 | __explicit_bzero_chk_internal (buf, len, __bos0 (buf)) | 
|---|
| 127 | #elif !IS_IN (nonlib) | 
|---|
| 128 | void __explicit_bzero_chk (void *, size_t, size_t) __THROW __nonnull ((1)); | 
|---|
| 129 | # define explicit_bzero(buf, len) __explicit_bzero_chk (buf, len, __bos0 (buf)) | 
|---|
| 130 | #endif | 
|---|
| 131 |  | 
|---|
| 132 | libc_hidden_builtin_proto (memchr) | 
|---|
| 133 | libc_hidden_builtin_proto (memcpy) | 
|---|
| 134 | libc_hidden_builtin_proto (mempcpy) | 
|---|
| 135 | libc_hidden_builtin_proto (memcmp) | 
|---|
| 136 | libc_hidden_builtin_proto (memmove) | 
|---|
| 137 | libc_hidden_builtin_proto (memset) | 
|---|
| 138 | libc_hidden_builtin_proto (strcat) | 
|---|
| 139 | libc_hidden_builtin_proto (strchr) | 
|---|
| 140 | libc_hidden_builtin_proto (strcmp) | 
|---|
| 141 | libc_hidden_builtin_proto (strcpy) | 
|---|
| 142 | libc_hidden_builtin_proto (strcspn) | 
|---|
| 143 | libc_hidden_builtin_proto (strlen) | 
|---|
| 144 | libc_hidden_builtin_proto (strncmp) | 
|---|
| 145 | libc_hidden_builtin_proto (strncpy) | 
|---|
| 146 | libc_hidden_builtin_proto (strpbrk) | 
|---|
| 147 | libc_hidden_builtin_proto (stpcpy) | 
|---|
| 148 | libc_hidden_builtin_proto (strrchr) | 
|---|
| 149 | libc_hidden_builtin_proto (strspn) | 
|---|
| 150 | libc_hidden_builtin_proto (strstr) | 
|---|
| 151 | libc_hidden_builtin_proto (ffs) | 
|---|
| 152 |  | 
|---|
| 153 | #if IS_IN (rtld) && !defined NO_RTLD_HIDDEN | 
|---|
| 154 | extern __typeof (__stpcpy) __stpcpy attribute_hidden; | 
|---|
| 155 | extern __typeof (__strdup) __strdup attribute_hidden; | 
|---|
| 156 | extern __typeof (__strerror_r) __strerror_r attribute_hidden; | 
|---|
| 157 | extern __typeof (__strsep_g) __strsep_g attribute_hidden; | 
|---|
| 158 |  | 
|---|
| 159 | extern __typeof (memchr) memchr attribute_hidden; | 
|---|
| 160 | extern __typeof (memcmp) memcmp attribute_hidden; | 
|---|
| 161 | extern __typeof (memcpy) memcpy attribute_hidden; | 
|---|
| 162 | extern __typeof (memmove) memmove attribute_hidden; | 
|---|
| 163 | extern __typeof (memset) memset attribute_hidden; | 
|---|
| 164 | extern __typeof (rawmemchr) rawmemchr attribute_hidden; | 
|---|
| 165 | extern __typeof (stpcpy) stpcpy attribute_hidden; | 
|---|
| 166 | extern __typeof (strchr) strchr attribute_hidden; | 
|---|
| 167 | extern __typeof (strcmp) strcmp attribute_hidden; | 
|---|
| 168 | extern __typeof (strlen) strlen attribute_hidden; | 
|---|
| 169 | extern __typeof (strnlen) strnlen attribute_hidden; | 
|---|
| 170 | extern __typeof (strsep) strsep attribute_hidden; | 
|---|
| 171 | #endif | 
|---|
| 172 |  | 
|---|
| 173 | #if (!IS_IN (libc) || !defined SHARED) \ | 
|---|
| 174 | && !defined NO_MEMPCPY_STPCPY_REDIRECT | 
|---|
| 175 | /* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call | 
|---|
| 176 | __mempcpy and __stpcpy if not inlined.  */ | 
|---|
| 177 | extern __typeof (mempcpy) mempcpy __asm__ ( "__mempcpy"); | 
|---|
| 178 | extern __typeof (stpcpy) stpcpy __asm__ ( "__stpcpy"); | 
|---|
| 179 | #endif | 
|---|
| 180 |  | 
|---|
| 181 | extern void *__memcpy_chk (void *__restrict __dest, | 
|---|
| 182 | const void *__restrict __src, size_t __len, | 
|---|
| 183 | size_t __destlen) __THROW; | 
|---|
| 184 | extern void *__memmove_chk (void *__dest, const void *__src, size_t __len, | 
|---|
| 185 | size_t __destlen) __THROW; | 
|---|
| 186 | extern void *__mempcpy_chk (void *__restrict __dest, | 
|---|
| 187 | const void *__restrict __src, size_t __len, | 
|---|
| 188 | size_t __destlen) __THROW; | 
|---|
| 189 | extern void *__memset_chk (void *__dest, int __ch, size_t __len, | 
|---|
| 190 | size_t __destlen) __THROW; | 
|---|
| 191 | extern char *__strcpy_chk (char *__restrict __dest, | 
|---|
| 192 | const char *__restrict __src, | 
|---|
| 193 | size_t __destlen) __THROW; | 
|---|
| 194 | extern char *__stpcpy_chk (char *__restrict __dest, | 
|---|
| 195 | const char *__restrict __src, | 
|---|
| 196 | size_t __destlen) __THROW; | 
|---|
| 197 | extern char *__strncpy_chk (char *__restrict __dest, | 
|---|
| 198 | const char *__restrict __src, | 
|---|
| 199 | size_t __len, size_t __destlen) __THROW; | 
|---|
| 200 | extern char *__strcat_chk (char *__restrict __dest, | 
|---|
| 201 | const char *__restrict __src, | 
|---|
| 202 | size_t __destlen) __THROW; | 
|---|
| 203 | extern char *__strncat_chk (char *__restrict __dest, | 
|---|
| 204 | const char *__restrict __src, | 
|---|
| 205 | size_t __len, size_t __destlen) __THROW; | 
|---|
| 206 | #endif | 
|---|
| 207 |  | 
|---|
| 208 | #endif | 
|---|
| 209 |  | 
|---|