microblaze: Use <fenv.h> fallback functions
[jlayton/glibc.git] / include / string.h
1 #ifndef _STRING_H
2
3 #ifndef _ISOMAC
4 #include <sys/types.h>
5
6 extern void *__memccpy (void *__dest, const void *__src,
7                         int __c, size_t __n);
8
9 extern size_t __strnlen (const char *__string, size_t __maxlen)
10      __attribute_pure__;
11
12 extern char *__strsep (char **__stringp, const char *__delim);
13
14 extern int __strverscmp (const char *__s1, const char *__s2)
15      __attribute_pure__;
16
17 extern int __strncasecmp (const char *__s1, const char *__s2,
18                           size_t __n)
19      __attribute_pure__;
20
21 extern int __strcasecmp (const char *__s1, const char *__s2)
22      __attribute_pure__;
23
24 extern char *__strcasestr (const char *__haystack, const char *__needle)
25      __attribute_pure__;
26
27 extern char *__strdup (const char *__string)
28      __attribute_malloc__;
29 extern char *__strndup (const char *__string, size_t __n)
30      __attribute_malloc__;
31
32 extern void *__rawmemchr (const void *__s, int __c)
33      __attribute_pure__;
34
35 extern char *__strchrnul (const char *__s, int __c)
36      __attribute_pure__;
37
38 extern void *__memrchr (const void *__s, int __c, size_t __n)
39      __attribute_pure__;
40
41 extern void *__memchr (const void *__s, int __c, size_t __n)
42      __attribute_pure__;
43
44 extern int __ffs (int __i) __attribute__ ((const));
45
46 extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
47 #endif
48
49 /* Now the real definitions.  We do this here since some of the functions
50    above are defined as macros in the headers.  */
51 #include <string/string.h>
52
53 #ifndef _ISOMAC
54 extern __typeof (strcoll_l) __strcoll_l;
55 extern __typeof (strxfrm_l) __strxfrm_l;
56 extern __typeof (strcasecmp_l) __strcasecmp_l;
57 extern __typeof (strncasecmp_l) __strncasecmp_l;
58
59 /* Alternative version which doesn't pollute glibc's namespace.  */
60 #ifndef NOT_IN_libc
61 # undef strndupa
62 # define strndupa(s, n)                                                       \
63   (__extension__                                                              \
64     ({                                                                        \
65       const char *__old = (s);                                                \
66       size_t __len = __strnlen (__old, (n));                                  \
67       char *__new = (char *) __builtin_alloca (__len + 1);                    \
68       __new[__len] = '\0';                                                    \
69       (char *) memcpy (__new, __old, __len);                                  \
70     }))
71 #endif
72
73 libc_hidden_proto (__mempcpy)
74 libc_hidden_proto (__stpcpy)
75 libc_hidden_proto (__stpncpy)
76 libc_hidden_proto (__rawmemchr)
77 libc_hidden_proto (__strcasecmp)
78 libc_hidden_proto (__strcasecmp_l)
79 libc_hidden_proto (__strncasecmp_l)
80 libc_hidden_proto (__strdup)
81 libc_hidden_proto (__strndup)
82 libc_hidden_proto (__strerror_r)
83 libc_hidden_proto (__strverscmp)
84 libc_hidden_proto (basename)
85 libc_hidden_proto (strcoll)
86 libc_hidden_proto (__strcoll_l)
87 libc_hidden_proto (__strxfrm_l)
88 libc_hidden_proto (__strtok_r)
89 extern char *__strsep_g (char **__stringp, const char *__delim);
90 libc_hidden_proto (__strsep_g)
91 libc_hidden_proto (strnlen)
92 libc_hidden_proto (memmem)
93 libc_hidden_proto (__ffs)
94
95 libc_hidden_builtin_proto (memchr)
96 libc_hidden_builtin_proto (memcpy)
97 libc_hidden_builtin_proto (mempcpy)
98 libc_hidden_builtin_proto (memcmp)
99 libc_hidden_builtin_proto (memmove)
100 libc_hidden_builtin_proto (memset)
101 libc_hidden_builtin_proto (strcat)
102 libc_hidden_builtin_proto (strchr)
103 libc_hidden_builtin_proto (strcmp)
104 libc_hidden_builtin_proto (strcpy)
105 libc_hidden_builtin_proto (strcspn)
106 libc_hidden_builtin_proto (strlen)
107 libc_hidden_builtin_proto (strncmp)
108 libc_hidden_builtin_proto (strncpy)
109 libc_hidden_builtin_proto (strpbrk)
110 libc_hidden_builtin_proto (stpcpy)
111 libc_hidden_builtin_proto (strrchr)
112 libc_hidden_builtin_proto (strspn)
113 libc_hidden_builtin_proto (strstr)
114 libc_hidden_builtin_proto (ffs)
115
116 # ifndef _ISOMAC
117 #  ifndef index
118 #   define index(s, c)  (strchr ((s), (c)))
119 #  endif
120 #  ifndef rindex
121 #   define rindex(s, c) (strrchr ((s), (c)))
122 #  endif
123 # endif
124
125 extern void *__memcpy_chk (void *__restrict __dest,
126                            const void *__restrict __src, size_t __len,
127                            size_t __destlen) __THROW;
128 extern void *__memmove_chk (void *__dest, const void *__src, size_t __len,
129                             size_t __destlen) __THROW;
130 extern void *__mempcpy_chk (void *__restrict __dest,
131                             const void *__restrict __src, size_t __len,
132                             size_t __destlen) __THROW;
133 extern void *__memset_chk (void *__dest, int __ch, size_t __len,
134                            size_t __destlen) __THROW;
135 extern char *__strcpy_chk (char *__restrict __dest,
136                            const char *__restrict __src,
137                            size_t __destlen) __THROW;
138 extern char *__stpcpy_chk (char *__restrict __dest,
139                            const char *__restrict __src,
140                            size_t __destlen) __THROW;
141 extern char *__strncpy_chk (char *__restrict __dest,
142                             const char *__restrict __src,
143                             size_t __len, size_t __destlen) __THROW;
144 extern char *__strcat_chk (char *__restrict __dest,
145                            const char *__restrict __src,
146                            size_t __destlen) __THROW;
147 extern char *__strncat_chk (char *__restrict __dest,
148                             const char *__restrict __src,
149                             size_t __len, size_t __destlen) __THROW;
150 #endif
151
152 #endif