Add fesetexcept: s390.
[glibc.git] / include / string.h
blobe145bfdb4cb781fbced37634410dd2b844571f16
1 #ifndef _STRING_H
3 #ifndef _ISOMAC
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 int __ffs (int __i) __attribute__ ((const));
46 extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
47 #endif
49 /* Get _STRING_ARCH_unaligned. */
50 #include <string_private.h>
52 /* Now the real definitions. We do this here since some of the functions
53 above are defined as macros in the headers. */
54 #include <string/string.h>
56 #ifndef _ISOMAC
57 extern __typeof (strcoll_l) __strcoll_l;
58 extern __typeof (strxfrm_l) __strxfrm_l;
59 extern __typeof (strcasecmp_l) __strcasecmp_l;
60 extern __typeof (strncasecmp_l) __strncasecmp_l;
62 /* Alternative version which doesn't pollute glibc's namespace. */
63 #if IS_IN (libc)
64 # undef strndupa
65 # define strndupa(s, n) \
66 (__extension__ \
67 ({ \
68 const char *__old = (s); \
69 size_t __len = __strnlen (__old, (n)); \
70 char *__new = (char *) __builtin_alloca (__len + 1); \
71 __new[__len] = '\0'; \
72 (char *) memcpy (__new, __old, __len); \
73 }))
74 #endif
76 libc_hidden_proto (__mempcpy)
77 libc_hidden_proto (__stpcpy)
78 libc_hidden_proto (__stpncpy)
79 libc_hidden_proto (__rawmemchr)
80 libc_hidden_proto (__strcasecmp)
81 libc_hidden_proto (__strcasecmp_l)
82 libc_hidden_proto (__strncasecmp_l)
83 libc_hidden_proto (__strdup)
84 libc_hidden_proto (__strndup)
85 libc_hidden_proto (__strerror_r)
86 libc_hidden_proto (__strverscmp)
87 libc_hidden_proto (basename)
88 extern char *__basename (const char *__filename) __THROW __nonnull ((1));
89 libc_hidden_proto (__basename)
90 libc_hidden_proto (strcoll)
91 libc_hidden_proto (__strcoll_l)
92 libc_hidden_proto (__strxfrm_l)
93 libc_hidden_proto (__strtok_r)
94 extern char *__strsep_g (char **__stringp, const char *__delim);
95 libc_hidden_proto (__strsep_g)
96 libc_hidden_proto (strnlen)
97 libc_hidden_proto (__strnlen)
98 libc_hidden_proto (memmem)
99 extern __typeof (memmem) __memmem;
100 libc_hidden_proto (__memmem)
101 libc_hidden_proto (__ffs)
103 libc_hidden_builtin_proto (memchr)
104 libc_hidden_builtin_proto (memcpy)
105 libc_hidden_builtin_proto (mempcpy)
106 libc_hidden_builtin_proto (memcmp)
107 libc_hidden_builtin_proto (memmove)
108 libc_hidden_builtin_proto (memset)
109 libc_hidden_builtin_proto (strcat)
110 libc_hidden_builtin_proto (strchr)
111 libc_hidden_builtin_proto (strcmp)
112 libc_hidden_builtin_proto (strcpy)
113 libc_hidden_builtin_proto (strcspn)
114 libc_hidden_builtin_proto (strlen)
115 libc_hidden_builtin_proto (strncmp)
116 libc_hidden_builtin_proto (strncpy)
117 libc_hidden_builtin_proto (strpbrk)
118 libc_hidden_builtin_proto (stpcpy)
119 libc_hidden_builtin_proto (strrchr)
120 libc_hidden_builtin_proto (strspn)
121 libc_hidden_builtin_proto (strstr)
122 libc_hidden_builtin_proto (ffs)
124 #if IS_IN (rtld)
125 extern __typeof (__stpcpy) __stpcpy attribute_hidden;
126 extern __typeof (__strdup) __strdup attribute_hidden;
127 extern __typeof (__strerror_r) __strerror_r attribute_hidden;
128 extern __typeof (__strsep_g) __strsep_g attribute_hidden;
130 extern __typeof (memchr) memchr attribute_hidden;
131 extern __typeof (memcmp) memcmp attribute_hidden;
132 extern __typeof (memcpy) memcpy attribute_hidden;
133 extern __typeof (memmove) memmove attribute_hidden;
134 extern __typeof (memset) memset attribute_hidden;
135 extern __typeof (rawmemchr) rawmemchr attribute_hidden;
136 extern __typeof (stpcpy) stpcpy attribute_hidden;
137 extern __typeof (strchr) strchr attribute_hidden;
138 extern __typeof (strcmp) strcmp attribute_hidden;
139 extern __typeof (strlen) strlen attribute_hidden;
140 extern __typeof (strnlen) strnlen attribute_hidden;
141 extern __typeof (strsep) strsep attribute_hidden;
142 #endif
144 #if (!IS_IN (libc) || !defined SHARED) \
145 && !defined NO_MEMPCPY_STPCPY_REDIRECT
146 /* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
147 __mempcpy and __stpcpy if not inlined. */
148 extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
149 extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
150 #endif
152 # ifndef _ISOMAC
153 # ifndef index
154 # define index(s, c) (strchr ((s), (c)))
155 # endif
156 # ifndef rindex
157 # define rindex(s, c) (strrchr ((s), (c)))
158 # endif
159 # endif
161 extern void *__memcpy_chk (void *__restrict __dest,
162 const void *__restrict __src, size_t __len,
163 size_t __destlen) __THROW;
164 extern void *__memmove_chk (void *__dest, const void *__src, size_t __len,
165 size_t __destlen) __THROW;
166 extern void *__mempcpy_chk (void *__restrict __dest,
167 const void *__restrict __src, size_t __len,
168 size_t __destlen) __THROW;
169 extern void *__memset_chk (void *__dest, int __ch, size_t __len,
170 size_t __destlen) __THROW;
171 extern char *__strcpy_chk (char *__restrict __dest,
172 const char *__restrict __src,
173 size_t __destlen) __THROW;
174 extern char *__stpcpy_chk (char *__restrict __dest,
175 const char *__restrict __src,
176 size_t __destlen) __THROW;
177 extern char *__strncpy_chk (char *__restrict __dest,
178 const char *__restrict __src,
179 size_t __len, size_t __destlen) __THROW;
180 extern char *__strcat_chk (char *__restrict __dest,
181 const char *__restrict __src,
182 size_t __destlen) __THROW;
183 extern char *__strncat_chk (char *__restrict __dest,
184 const char *__restrict __src,
185 size_t __len, size_t __destlen) __THROW;
186 #endif
188 #endif