sparc: Fix .udiv plt on libc
[glibc.git] / include / string.h
blobf166de9c43c8cb89e7a7a796c632e514af41edd1
1 #ifndef _STRING_H
3 #if !defined _ISOMAC && !defined __cplusplus
4 #include <sys/types.h>
6 extern void *__memccpy (void *__dest, const void *__src,
7 int __c, size_t __n);
9 extern size_t __strnlen (const char *__string, size_t __maxlen)
10 __attribute_pure__;
12 extern char *__strsep (char **__stringp, const char *__delim);
14 extern int __strverscmp (const char *__s1, const char *__s2)
15 __attribute_pure__;
17 extern int __strncasecmp (const char *__s1, const char *__s2,
18 size_t __n)
19 __attribute_pure__;
21 extern int __strcasecmp (const char *__s1, const char *__s2)
22 __attribute_pure__;
24 extern char *__strcasestr (const char *__haystack, const char *__needle)
25 __attribute_pure__;
27 extern char *__strdup (const char *__string)
28 __attribute_malloc__;
29 extern char *__strndup (const char *__string, size_t __n)
30 __attribute_malloc__;
32 extern void *__rawmemchr (const void *__s, int __c)
33 __attribute_pure__;
35 extern char *__strchrnul (const char *__s, int __c)
36 __attribute_pure__;
38 extern void *__memrchr (const void *__s, int __c, size_t __n)
39 __attribute_pure__;
41 extern void *__memchr (const void *__s, int __c, size_t __n)
42 __attribute_pure__;
44 extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
46 extern int __ffs (int __i) __attribute__ ((const));
48 extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
49 #endif
51 /* Get _STRING_ARCH_unaligned. */
52 #include <string_private.h>
54 /* Now the real definitions. We do this here since some of the functions
55 above are defined as macros in the headers. */
56 #include <string/string.h>
58 #if !defined _ISOMAC && !defined __cplusplus
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;
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
78 libc_hidden_proto (__mempcpy)
79 libc_hidden_proto (__stpcpy)
80 libc_hidden_proto (__stpncpy)
81 libc_hidden_proto (__rawmemchr)
82 libc_hidden_proto (__strcasecmp)
83 libc_hidden_proto (__strcasecmp_l)
84 libc_hidden_proto (__strncasecmp_l)
85 libc_hidden_proto (__strdup)
86 libc_hidden_proto (__strndup)
87 libc_hidden_proto (__strerror_r)
88 libc_hidden_proto (__strverscmp)
89 libc_hidden_proto (basename)
90 extern char *__basename (const char *__filename) __THROW __nonnull ((1));
91 libc_hidden_proto (__basename)
92 libc_hidden_proto (strcoll)
93 libc_hidden_proto (__strcoll_l)
94 libc_hidden_proto (__strxfrm_l)
95 libc_hidden_proto (__strtok_r)
96 extern char *__strsep_g (char **__stringp, const char *__delim);
97 libc_hidden_proto (__strsep_g)
98 libc_hidden_proto (strnlen)
99 libc_hidden_proto (__strnlen)
100 libc_hidden_proto (memmem)
101 extern __typeof (memmem) __memmem;
102 libc_hidden_proto (__memmem)
103 libc_hidden_proto (__ffs)
105 #if IS_IN (libc)
106 /* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk. */
107 void __explicit_bzero_chk_internal (void *, size_t, size_t)
108 __THROW __nonnull ((1)) attribute_hidden;
109 # define explicit_bzero(buf, len) \
110 __explicit_bzero_chk_internal (buf, len, __bos0 (buf))
111 #elif !IS_IN (nonlib)
112 void __explicit_bzero_chk (void *, size_t, size_t) __THROW __nonnull ((1));
113 # define explicit_bzero(buf, len) __explicit_bzero_chk (buf, len, __bos0 (buf))
114 #endif
116 libc_hidden_builtin_proto (memchr)
117 libc_hidden_builtin_proto (memcpy)
118 libc_hidden_builtin_proto (mempcpy)
119 libc_hidden_builtin_proto (memcmp)
120 libc_hidden_builtin_proto (memmove)
121 libc_hidden_builtin_proto (memset)
122 libc_hidden_builtin_proto (strcat)
123 libc_hidden_builtin_proto (strchr)
124 libc_hidden_builtin_proto (strcmp)
125 libc_hidden_builtin_proto (strcpy)
126 libc_hidden_builtin_proto (strcspn)
127 libc_hidden_builtin_proto (strlen)
128 libc_hidden_builtin_proto (strncmp)
129 libc_hidden_builtin_proto (strncpy)
130 libc_hidden_builtin_proto (strpbrk)
131 libc_hidden_builtin_proto (stpcpy)
132 libc_hidden_builtin_proto (strrchr)
133 libc_hidden_builtin_proto (strspn)
134 libc_hidden_builtin_proto (strstr)
135 libc_hidden_builtin_proto (ffs)
137 #if IS_IN (rtld)
138 extern __typeof (__stpcpy) __stpcpy attribute_hidden;
139 extern __typeof (__strdup) __strdup attribute_hidden;
140 extern __typeof (__strerror_r) __strerror_r attribute_hidden;
141 extern __typeof (__strsep_g) __strsep_g attribute_hidden;
143 extern __typeof (memchr) memchr attribute_hidden;
144 extern __typeof (memcmp) memcmp attribute_hidden;
145 extern __typeof (memcpy) memcpy attribute_hidden;
146 extern __typeof (memmove) memmove attribute_hidden;
147 extern __typeof (memset) memset attribute_hidden;
148 extern __typeof (rawmemchr) rawmemchr attribute_hidden;
149 extern __typeof (stpcpy) stpcpy attribute_hidden;
150 extern __typeof (strchr) strchr attribute_hidden;
151 extern __typeof (strcmp) strcmp attribute_hidden;
152 extern __typeof (strlen) strlen attribute_hidden;
153 extern __typeof (strnlen) strnlen attribute_hidden;
154 extern __typeof (strsep) strsep attribute_hidden;
155 #endif
157 #if (!IS_IN (libc) || !defined SHARED) \
158 && !defined NO_MEMPCPY_STPCPY_REDIRECT
159 /* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
160 __mempcpy and __stpcpy if not inlined. */
161 extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
162 extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
163 #endif
165 extern void *__memcpy_chk (void *__restrict __dest,
166 const void *__restrict __src, size_t __len,
167 size_t __destlen) __THROW;
168 extern void *__memmove_chk (void *__dest, const void *__src, size_t __len,
169 size_t __destlen) __THROW;
170 extern void *__mempcpy_chk (void *__restrict __dest,
171 const void *__restrict __src, size_t __len,
172 size_t __destlen) __THROW;
173 extern void *__memset_chk (void *__dest, int __ch, size_t __len,
174 size_t __destlen) __THROW;
175 extern char *__strcpy_chk (char *__restrict __dest,
176 const char *__restrict __src,
177 size_t __destlen) __THROW;
178 extern char *__stpcpy_chk (char *__restrict __dest,
179 const char *__restrict __src,
180 size_t __destlen) __THROW;
181 extern char *__strncpy_chk (char *__restrict __dest,
182 const char *__restrict __src,
183 size_t __len, size_t __destlen) __THROW;
184 extern char *__strcat_chk (char *__restrict __dest,
185 const char *__restrict __src,
186 size_t __destlen) __THROW;
187 extern char *__strncat_chk (char *__restrict __dest,
188 const char *__restrict __src,
189 size_t __len, size_t __destlen) __THROW;
190 #endif
192 #endif