4 /* Some of these are defined as macros in the real string.h, so we must
5 prototype them before including it. */
9 extern void *__memccpy (void *__dest
, const void *__src
,
12 extern size_t __strnlen (const char *__string
, size_t __maxlen
)
15 extern char *__strsep (char **__stringp
, const char *__delim
);
16 libc_hidden_proto (__strsep
)
18 extern int __strverscmp (const char *__s1
, const char *__s2
)
21 extern int __strncasecmp (const char *__s1
, const char *__s2
,
25 extern int __strcasecmp (const char *__s1
, const char *__s2
)
28 extern char *__strcasestr (const char *__haystack
, const char *__needle
)
31 extern char *__strdup (const char *__string
)
33 extern char *__strndup (const char *__string
, size_t __n
)
36 extern void *__rawmemchr (const void *__s
, int __c
)
39 extern char *__strchrnul (const char *__s
, int __c
)
42 extern void *__memrchr (const void *__s
, int __c
, size_t __n
)
45 extern void *__memchr (const void *__s
, int __c
, size_t __n
)
48 extern void __bzero (void *__s
, size_t __n
) __THROW
__nonnull ((1));
50 extern int __ffs (int __i
) __attribute__ ((const));
52 extern char *__strerror_r (int __errnum
, char *__buf
, size_t __buflen
);
54 extern char *__strerror_l (int __errnum
, locale_t __loc
);
56 extern const char *__sigdescr_np (int __errnum
);
57 libc_hidden_proto (__sigdescr_np
)
60 #include <string/string.h>
63 extern __typeof (strcoll_l
) __strcoll_l
;
64 extern __typeof (strxfrm_l
) __strxfrm_l
;
65 extern __typeof (strcasecmp_l
) __strcasecmp_l
;
66 extern __typeof (strncasecmp_l
) __strncasecmp_l
;
68 /* Alternative version which doesn't pollute glibc's namespace. */
71 # define strndupa(s, n) \
74 const char *__old = (s); \
75 size_t __len = __strnlen (__old, (n)); \
76 char *__new = (char *) __builtin_alloca (__len + 1); \
77 __new[__len] = '\0'; \
78 (char *) memcpy (__new, __old, __len); \
82 libc_hidden_proto (__mempcpy
)
83 #ifndef __NO_STRING_INLINES
84 # define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n)
86 libc_hidden_proto (__stpcpy
)
87 #ifndef __NO_STRING_INLINES
88 # define __stpcpy(dest, src) __builtin_stpcpy (dest, src)
90 libc_hidden_proto (__stpncpy
)
91 extern __typeof (strlcpy
) __strlcpy
;
92 libc_hidden_proto (__strlcpy
)
93 extern __typeof (strlcat
) __strlcat
;
94 libc_hidden_proto (__strlcat
)
95 libc_hidden_proto (__rawmemchr
)
96 libc_hidden_proto (__strcasecmp
)
97 libc_hidden_proto (__strcasecmp_l
)
98 libc_hidden_proto (__strncasecmp_l
)
99 libc_hidden_proto (__strchrnul
)
100 extern __typeof (strncat
) __strncat
;
101 libc_hidden_proto (__strncat
)
102 libc_hidden_proto (__strdup
)
103 libc_hidden_proto (__strndup
)
104 libc_hidden_proto (__strerror_r
)
105 libc_hidden_proto (__strverscmp
)
106 libc_hidden_proto (basename
)
107 extern char *__basename (const char *__filename
) __THROW
__nonnull ((1));
108 libc_hidden_proto (__basename
)
109 libc_hidden_proto (strcoll
)
110 libc_hidden_proto (__strcoll_l
)
111 libc_hidden_proto (__strxfrm_l
)
112 libc_hidden_proto (__strtok_r
)
113 extern char *__strsep_g (char **__stringp
, const char *__delim
);
114 libc_hidden_proto (__strsep_g
)
115 libc_hidden_proto (strnlen
)
116 libc_hidden_proto (__strnlen
)
117 libc_hidden_proto (__memcmpeq
)
118 libc_hidden_proto (memmem
)
119 extern __typeof (memmem
) __memmem
;
120 libc_hidden_proto (__memmem
)
121 libc_hidden_proto (__ffs
)
122 libc_hidden_proto (__strerror_l
)
123 libc_hidden_proto (__memrchr
)
126 /* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk. */
127 void __explicit_bzero_chk_internal (void *, size_t, size_t)
128 __THROW
__nonnull ((1)) attribute_hidden
;
129 # define explicit_bzero(buf, len) \
130 __explicit_bzero_chk_internal (buf, len, __glibc_objsize0 (buf))
131 #elif !IS_IN (nonlib)
132 void __explicit_bzero_chk (void *, size_t, size_t) __THROW
__nonnull ((1));
133 # define explicit_bzero(buf, len) __explicit_bzero_chk (buf, len, \
134 __glibc_objsize0 (buf))
137 libc_hidden_builtin_proto (memchr
)
138 libc_hidden_builtin_proto (memcpy
)
139 libc_hidden_builtin_proto (mempcpy
)
140 libc_hidden_builtin_proto (memcmp
)
141 libc_hidden_builtin_proto (memmove
)
142 libc_hidden_builtin_proto (memset
)
143 libc_hidden_builtin_proto (strcat
)
144 libc_hidden_builtin_proto (strchr
)
145 libc_hidden_builtin_proto (strcmp
)
146 libc_hidden_builtin_proto (strcpy
)
147 libc_hidden_builtin_proto (strcspn
)
148 libc_hidden_builtin_proto (strlen
)
149 libc_hidden_builtin_proto (strncmp
)
150 libc_hidden_builtin_proto (strncpy
)
151 libc_hidden_builtin_proto (strpbrk
)
152 libc_hidden_builtin_proto (stpcpy
)
153 libc_hidden_builtin_proto (strrchr
)
154 libc_hidden_builtin_proto (strspn
)
155 libc_hidden_builtin_proto (strstr
)
156 libc_hidden_builtin_proto (ffs
)
159 extern __typeof (__stpcpy
) __stpcpy attribute_hidden
;
160 extern __typeof (__strdup
) __strdup attribute_hidden
;
161 extern __typeof (__strerror_r
) __strerror_r attribute_hidden
;
162 extern __typeof (__strsep_g
) __strsep_g attribute_hidden
;
164 extern __typeof (memchr
) memchr attribute_hidden
;
165 extern __typeof (memcmp
) memcmp attribute_hidden
;
166 extern __typeof (memcpy
) memcpy attribute_hidden
;
167 extern __typeof (memmove
) memmove attribute_hidden
;
168 extern __typeof (memset
) memset attribute_hidden
;
169 extern __typeof (rawmemchr
) rawmemchr attribute_hidden
;
170 extern __typeof (stpcpy
) stpcpy attribute_hidden
;
171 extern __typeof (strchr
) strchr attribute_hidden
;
172 extern __typeof (strcmp
) strcmp attribute_hidden
;
173 extern __typeof (strlen
) strlen attribute_hidden
;
174 extern __typeof (strnlen
) strnlen attribute_hidden
;
175 extern __typeof (strsep
) strsep attribute_hidden
;
178 #if (!IS_IN (libc) || !defined SHARED) \
179 && !defined NO_MEMPCPY_STPCPY_REDIRECT
180 /* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
181 __mempcpy and __stpcpy if not inlined. */
182 extern __typeof (mempcpy
) mempcpy
__asm__ ("__mempcpy");
183 extern __typeof (stpcpy
) stpcpy
__asm__ ("__stpcpy");
186 extern void *__memcpy_chk (void *__restrict __dest
,
187 const void *__restrict __src
, size_t __len
,
188 size_t __destlen
) __THROW
;
189 extern void *__memmove_chk (void *__dest
, const void *__src
, size_t __len
,
190 size_t __destlen
) __THROW
;
191 extern void *__mempcpy_chk (void *__restrict __dest
,
192 const void *__restrict __src
, size_t __len
,
193 size_t __destlen
) __THROW
;
194 extern void *__memset_chk (void *__dest
, int __ch
, size_t __len
,
195 size_t __destlen
) __THROW
;
196 extern char *__strcpy_chk (char *__restrict __dest
,
197 const char *__restrict __src
,
198 size_t __destlen
) __THROW
;
199 extern char *__stpcpy_chk (char *__restrict __dest
,
200 const char *__restrict __src
,
201 size_t __destlen
) __THROW
;
202 extern char *__strncpy_chk (char *__restrict __dest
,
203 const char *__restrict __src
,
204 size_t __len
, size_t __destlen
) __THROW
;
205 extern char *__strcat_chk (char *__restrict __dest
,
206 const char *__restrict __src
,
207 size_t __destlen
) __THROW
;
208 extern char *__strncat_chk (char *__restrict __dest
,
209 const char *__restrict __src
,
210 size_t __len
, size_t __destlen
) __THROW
;
212 libc_hidden_builtin_proto (__memcpy_chk
)
213 libc_hidden_builtin_proto (__memmove_chk
)
214 libc_hidden_builtin_proto (__mempcpy_chk
)
215 libc_hidden_builtin_proto (__memset_chk
)
216 libc_hidden_builtin_proto (__stpcpy_chk
)
217 libc_hidden_builtin_proto (__strncpy_chk
)