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