]>
Commit | Line | Data |
---|---|---|
6796bc80 | 1 | #ifndef _STRING_H |
bdbf022d | 2 | |
7c3018f9 ZW |
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. */ | |
8d2d51e3 UD |
6 | #include <sys/types.h> |
7 | ||
a784e502 | 8 | extern void *__memccpy (void *__dest, const void *__src, |
b5cc329c | 9 | int __c, size_t __n); |
5c2a0669 | 10 | |
a784e502 | 11 | extern size_t __strnlen (const char *__string, size_t __maxlen) |
ca5a4c3c | 12 | __attribute_pure__; |
5c2a0669 | 13 | |
a784e502 | 14 | extern char *__strsep (char **__stringp, const char *__delim); |
5c2a0669 | 15 | |
a784e502 | 16 | extern int __strverscmp (const char *__s1, const char *__s2) |
ca5a4c3c | 17 | __attribute_pure__; |
5c2a0669 | 18 | |
a784e502 | 19 | extern int __strncasecmp (const char *__s1, const char *__s2, |
ca5a4c3c AJ |
20 | size_t __n) |
21 | __attribute_pure__; | |
5c2a0669 | 22 | |
a784e502 | 23 | extern int __strcasecmp (const char *__s1, const char *__s2) |
aab09639 UD |
24 | __attribute_pure__; |
25 | ||
a784e502 | 26 | extern char *__strcasestr (const char *__haystack, const char *__needle) |
aab09639 UD |
27 | __attribute_pure__; |
28 | ||
a784e502 | 29 | extern char *__strdup (const char *__string) |
1474648d | 30 | __attribute_malloc__; |
a784e502 | 31 | extern char *__strndup (const char *__string, size_t __n) |
2a505c96 | 32 | __attribute_malloc__; |
5c2a0669 | 33 | |
a784e502 | 34 | extern void *__rawmemchr (const void *__s, int __c) |
ca5a4c3c | 35 | __attribute_pure__; |
482eec0d | 36 | |
a784e502 | 37 | extern char *__strchrnul (const char *__s, int __c) |
ca5a4c3c | 38 | __attribute_pure__; |
390500b1 | 39 | |
a784e502 | 40 | extern void *__memrchr (const void *__s, int __c, size_t __n) |
ca5a4c3c | 41 | __attribute_pure__; |
fbda91b1 | 42 | |
a784e502 | 43 | extern void *__memchr (const void *__s, int __c, size_t __n) |
80f41baa | 44 | __attribute_pure__; |
bd7f30a9 | 45 | |
7b037c09 ZW |
46 | extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1)); |
47 | ||
bd7f30a9 AJ |
48 | extern int __ffs (int __i) __attribute__ ((const)); |
49 | ||
50 | extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen); | |
51 | ||
16396c41 L |
52 | /* Get _STRING_ARCH_unaligned. */ |
53 | #include <string_private.h> | |
7c3018f9 | 54 | #endif |
16396c41 | 55 | |
8d2d51e3 | 56 | #include <string/string.h> |
5a3fba99 | 57 | |
7c3018f9 | 58 | #ifndef _ISOMAC |
da4cfe38 RM |
59 | extern __typeof (strcoll_l) __strcoll_l; |
60 | extern __typeof (strxfrm_l) __strxfrm_l; | |
61 | extern __typeof (strcasecmp_l) __strcasecmp_l; | |
62 | extern __typeof (strncasecmp_l) __strncasecmp_l; | |
63 | ||
5a3fba99 | 64 | /* Alternative version which doesn't pollute glibc's namespace. */ |
4f41c682 | 65 | #if IS_IN (libc) |
23691ab2 UD |
66 | # undef strndupa |
67 | # define strndupa(s, n) \ | |
5a3fba99 UD |
68 | (__extension__ \ |
69 | ({ \ | |
a784e502 | 70 | const char *__old = (s); \ |
5a3fba99 UD |
71 | size_t __len = __strnlen (__old, (n)); \ |
72 | char *__new = (char *) __builtin_alloca (__len + 1); \ | |
73 | __new[__len] = '\0'; \ | |
74 | (char *) memcpy (__new, __old, __len); \ | |
75 | })) | |
23691ab2 | 76 | #endif |
37ba7d66 UD |
77 | |
78 | libc_hidden_proto (__mempcpy) | |
09a596cc ZW |
79 | #ifndef __NO_STRING_INLINES |
80 | # define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n) | |
81 | #endif | |
6111cd0e | 82 | libc_hidden_proto (__stpcpy) |
09a596cc ZW |
83 | #ifndef __NO_STRING_INLINES |
84 | # define __stpcpy(dest, src) __builtin_stpcpy (dest, src) | |
85 | #endif | |
37ba7d66 UD |
86 | libc_hidden_proto (__stpncpy) |
87 | libc_hidden_proto (__rawmemchr) | |
88 | libc_hidden_proto (__strcasecmp) | |
5b070c75 UD |
89 | libc_hidden_proto (__strcasecmp_l) |
90 | libc_hidden_proto (__strncasecmp_l) | |
09a596cc ZW |
91 | extern __typeof (strncat) __strncat; |
92 | libc_hidden_proto (__strncat) | |
5b070c75 UD |
93 | libc_hidden_proto (__strdup) |
94 | libc_hidden_proto (__strndup) | |
95 | libc_hidden_proto (__strerror_r) | |
a20d8dbe | 96 | libc_hidden_proto (__strverscmp) |
7a8bdff0 | 97 | libc_hidden_proto (basename) |
cf06a4e3 JM |
98 | extern char *__basename (const char *__filename) __THROW __nonnull ((1)); |
99 | libc_hidden_proto (__basename) | |
df962917 | 100 | libc_hidden_proto (strcoll) |
ccadf7b5 UD |
101 | libc_hidden_proto (__strcoll_l) |
102 | libc_hidden_proto (__strxfrm_l) | |
ee600e3f | 103 | libc_hidden_proto (__strtok_r) |
a784e502 | 104 | extern char *__strsep_g (char **__stringp, const char *__delim); |
ee600e3f | 105 | libc_hidden_proto (__strsep_g) |
710af5d7 | 106 | libc_hidden_proto (strnlen) |
17696087 | 107 | libc_hidden_proto (__strnlen) |
ca38dc17 | 108 | libc_hidden_proto (memmem) |
9975e3d3 JM |
109 | extern __typeof (memmem) __memmem; |
110 | libc_hidden_proto (__memmem) | |
5bb43a43 | 111 | libc_hidden_proto (__ffs) |
9b0b40d3 | 112 | |
ea1bd74d ZW |
113 | #if IS_IN (libc) |
114 | /* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk. */ | |
115 | void __explicit_bzero_chk_internal (void *, size_t, size_t) | |
116 | __THROW __nonnull ((1)) attribute_hidden; | |
117 | # define explicit_bzero(buf, len) \ | |
118 | __explicit_bzero_chk_internal (buf, len, __bos0 (buf)) | |
119 | #elif !IS_IN (nonlib) | |
120 | void __explicit_bzero_chk (void *, size_t, size_t) __THROW __nonnull ((1)); | |
121 | # define explicit_bzero(buf, len) __explicit_bzero_chk (buf, len, __bos0 (buf)) | |
122 | #endif | |
123 | ||
85dd1003 UD |
124 | libc_hidden_builtin_proto (memchr) |
125 | libc_hidden_builtin_proto (memcpy) | |
4a691b06 | 126 | libc_hidden_builtin_proto (mempcpy) |
758b2153 | 127 | libc_hidden_builtin_proto (memcmp) |
85dd1003 UD |
128 | libc_hidden_builtin_proto (memmove) |
129 | libc_hidden_builtin_proto (memset) | |
130 | libc_hidden_builtin_proto (strcat) | |
131 | libc_hidden_builtin_proto (strchr) | |
132 | libc_hidden_builtin_proto (strcmp) | |
133 | libc_hidden_builtin_proto (strcpy) | |
134 | libc_hidden_builtin_proto (strcspn) | |
135 | libc_hidden_builtin_proto (strlen) | |
136 | libc_hidden_builtin_proto (strncmp) | |
137 | libc_hidden_builtin_proto (strncpy) | |
138 | libc_hidden_builtin_proto (strpbrk) | |
4a691b06 | 139 | libc_hidden_builtin_proto (stpcpy) |
85dd1003 UD |
140 | libc_hidden_builtin_proto (strrchr) |
141 | libc_hidden_builtin_proto (strspn) | |
142 | libc_hidden_builtin_proto (strstr) | |
2dd18ce2 | 143 | libc_hidden_builtin_proto (ffs) |
85dd1003 | 144 | |
f8411468 L |
145 | #if IS_IN (rtld) |
146 | extern __typeof (__stpcpy) __stpcpy attribute_hidden; | |
147 | extern __typeof (__strdup) __strdup attribute_hidden; | |
148 | extern __typeof (__strerror_r) __strerror_r attribute_hidden; | |
149 | extern __typeof (__strsep_g) __strsep_g attribute_hidden; | |
150 | ||
151 | extern __typeof (memchr) memchr attribute_hidden; | |
152 | extern __typeof (memcmp) memcmp attribute_hidden; | |
153 | extern __typeof (memcpy) memcpy attribute_hidden; | |
154 | extern __typeof (memmove) memmove attribute_hidden; | |
155 | extern __typeof (memset) memset attribute_hidden; | |
156 | extern __typeof (rawmemchr) rawmemchr attribute_hidden; | |
157 | extern __typeof (stpcpy) stpcpy attribute_hidden; | |
158 | extern __typeof (strchr) strchr attribute_hidden; | |
159 | extern __typeof (strcmp) strcmp attribute_hidden; | |
160 | extern __typeof (strlen) strlen attribute_hidden; | |
161 | extern __typeof (strnlen) strnlen attribute_hidden; | |
162 | extern __typeof (strsep) strsep attribute_hidden; | |
163 | #endif | |
164 | ||
4f41c682 | 165 | #if (!IS_IN (libc) || !defined SHARED) \ |
c1b0aadc | 166 | && !defined NO_MEMPCPY_STPCPY_REDIRECT |
939da411 JM |
167 | /* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call |
168 | __mempcpy and __stpcpy if not inlined. */ | |
169 | extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy"); | |
170 | extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy"); | |
171 | #endif | |
172 | ||
b5cc329c UD |
173 | extern void *__memcpy_chk (void *__restrict __dest, |
174 | const void *__restrict __src, size_t __len, | |
175 | size_t __destlen) __THROW; | |
176 | extern void *__memmove_chk (void *__dest, const void *__src, size_t __len, | |
177 | size_t __destlen) __THROW; | |
178 | extern void *__mempcpy_chk (void *__restrict __dest, | |
179 | const void *__restrict __src, size_t __len, | |
180 | size_t __destlen) __THROW; | |
181 | extern void *__memset_chk (void *__dest, int __ch, size_t __len, | |
182 | size_t __destlen) __THROW; | |
183 | extern char *__strcpy_chk (char *__restrict __dest, | |
184 | const char *__restrict __src, | |
185 | size_t __destlen) __THROW; | |
186 | extern char *__stpcpy_chk (char *__restrict __dest, | |
187 | const char *__restrict __src, | |
188 | size_t __destlen) __THROW; | |
189 | extern char *__strncpy_chk (char *__restrict __dest, | |
190 | const char *__restrict __src, | |
191 | size_t __len, size_t __destlen) __THROW; | |
192 | extern char *__strcat_chk (char *__restrict __dest, | |
193 | const char *__restrict __src, | |
194 | size_t __destlen) __THROW; | |
195 | extern char *__strncat_chk (char *__restrict __dest, | |
196 | const char *__restrict __src, | |
197 | size_t __len, size_t __destlen) __THROW; | |
31341567 | 198 | #endif |
b5cc329c | 199 | |
9b0b40d3 | 200 | #endif |