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 | |
8 | extern void *__memccpy (void *__dest, const void *__src, |
9 | int __c, size_t __n); |
10 | |
11 | extern size_t __strnlen (const char *__string, size_t __maxlen) |
12 | __attribute_pure__; |
13 | |
14 | extern char *__strsep (char **__stringp, const char *__delim); |
15 | |
16 | extern int __strverscmp (const char *__s1, const char *__s2) |
17 | __attribute_pure__; |
18 | |
19 | extern int __strncasecmp (const char *__s1, const char *__s2, |
20 | size_t __n) |
21 | __attribute_pure__; |
22 | |
23 | extern int __strcasecmp (const char *__s1, const char *__s2) |
24 | __attribute_pure__; |
25 | |
26 | extern char *__strcasestr (const char *__haystack, const char *__needle) |
27 | __attribute_pure__; |
28 | |
29 | extern char *__strdup (const char *__string) |
30 | __attribute_malloc__; |
31 | extern char *__strndup (const char *__string, size_t __n) |
32 | __attribute_malloc__; |
33 | |
34 | extern void *__rawmemchr (const void *__s, int __c) |
35 | __attribute_pure__; |
36 | |
37 | extern char *__strchrnul (const char *__s, int __c) |
38 | __attribute_pure__; |
39 | |
40 | extern void *__memrchr (const void *__s, int __c, size_t __n) |
41 | __attribute_pure__; |
42 | |
43 | extern void *__memchr (const void *__s, int __c, size_t __n) |
44 | __attribute_pure__; |
45 | |
46 | extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1)); |
47 | |
48 | extern int __ffs (int __i) __attribute__ ((const)); |
49 | |
50 | extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen); |
51 | |
52 | /* Get _STRING_ARCH_unaligned. */ |
53 | #include <string_private.h> |
54 | #endif |
55 | |
56 | #include <string/string.h> |
57 | |
58 | #ifndef _ISOMAC |
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 | |
64 | /* Alternative version which doesn't pollute glibc's namespace. */ |
65 | #if IS_IN (libc) |
66 | # undef strndupa |
67 | # define strndupa(s, n) \ |
68 | (__extension__ \ |
69 | ({ \ |
70 | const char *__old = (s); \ |
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 | })) |
76 | #endif |
77 | |
78 | libc_hidden_proto (__mempcpy) |
79 | #ifndef __NO_STRING_INLINES |
80 | # define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n) |
81 | #endif |
82 | libc_hidden_proto (__stpcpy) |
83 | #ifndef __NO_STRING_INLINES |
84 | # define __stpcpy(dest, src) __builtin_stpcpy (dest, src) |
85 | #endif |
86 | libc_hidden_proto (__stpncpy) |
87 | libc_hidden_proto (__rawmemchr) |
88 | libc_hidden_proto (__strcasecmp) |
89 | libc_hidden_proto (__strcasecmp_l) |
90 | libc_hidden_proto (__strncasecmp_l) |
91 | extern __typeof (strncat) __strncat; |
92 | libc_hidden_proto (__strncat) |
93 | libc_hidden_proto (__strdup) |
94 | libc_hidden_proto (__strndup) |
95 | libc_hidden_proto (__strerror_r) |
96 | libc_hidden_proto (__strverscmp) |
97 | libc_hidden_proto (basename) |
98 | extern char *__basename (const char *__filename) __THROW __nonnull ((1)); |
99 | libc_hidden_proto (__basename) |
100 | libc_hidden_proto (strcoll) |
101 | libc_hidden_proto (__strcoll_l) |
102 | libc_hidden_proto (__strxfrm_l) |
103 | libc_hidden_proto (__strtok_r) |
104 | extern char *__strsep_g (char **__stringp, const char *__delim); |
105 | libc_hidden_proto (__strsep_g) |
106 | libc_hidden_proto (strnlen) |
107 | libc_hidden_proto (__strnlen) |
108 | libc_hidden_proto (memmem) |
109 | extern __typeof (memmem) __memmem; |
110 | libc_hidden_proto (__memmem) |
111 | libc_hidden_proto (__ffs) |
112 | |
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 | |
124 | libc_hidden_builtin_proto (memchr) |
125 | libc_hidden_builtin_proto (memcpy) |
126 | libc_hidden_builtin_proto (mempcpy) |
127 | libc_hidden_builtin_proto (memcmp) |
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) |
139 | libc_hidden_builtin_proto (stpcpy) |
140 | libc_hidden_builtin_proto (strrchr) |
141 | libc_hidden_builtin_proto (strspn) |
142 | libc_hidden_builtin_proto (strstr) |
143 | libc_hidden_builtin_proto (ffs) |
144 | |
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 | |
165 | #if (!IS_IN (libc) || !defined SHARED) \ |
166 | && !defined NO_MEMPCPY_STPCPY_REDIRECT |
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 | |
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; |
198 | #endif |
199 | |
200 | #endif |
201 | |