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

source code of glibc/include/string.h