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