]> git.ipfire.org Git - thirdparty/glibc.git/blame - include/string.h
Add per-thread cache to malloc
[thirdparty/glibc.git] / include / string.h
CommitLineData
6796bc80 1#ifndef _STRING_H
bdbf022d 2
7c3018f9
ZW
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. */
8d2d51e3
UD
6#include <sys/types.h>
7
a784e502 8extern void *__memccpy (void *__dest, const void *__src,
b5cc329c 9 int __c, size_t __n);
5c2a0669 10
a784e502 11extern size_t __strnlen (const char *__string, size_t __maxlen)
ca5a4c3c 12 __attribute_pure__;
5c2a0669 13
a784e502 14extern char *__strsep (char **__stringp, const char *__delim);
5c2a0669 15
a784e502 16extern int __strverscmp (const char *__s1, const char *__s2)
ca5a4c3c 17 __attribute_pure__;
5c2a0669 18
a784e502 19extern int __strncasecmp (const char *__s1, const char *__s2,
ca5a4c3c
AJ
20 size_t __n)
21 __attribute_pure__;
5c2a0669 22
a784e502 23extern int __strcasecmp (const char *__s1, const char *__s2)
aab09639
UD
24 __attribute_pure__;
25
a784e502 26extern char *__strcasestr (const char *__haystack, const char *__needle)
aab09639
UD
27 __attribute_pure__;
28
a784e502 29extern char *__strdup (const char *__string)
1474648d 30 __attribute_malloc__;
a784e502 31extern char *__strndup (const char *__string, size_t __n)
2a505c96 32 __attribute_malloc__;
5c2a0669 33
a784e502 34extern void *__rawmemchr (const void *__s, int __c)
ca5a4c3c 35 __attribute_pure__;
482eec0d 36
a784e502 37extern char *__strchrnul (const char *__s, int __c)
ca5a4c3c 38 __attribute_pure__;
390500b1 39
a784e502 40extern void *__memrchr (const void *__s, int __c, size_t __n)
ca5a4c3c 41 __attribute_pure__;
fbda91b1 42
a784e502 43extern void *__memchr (const void *__s, int __c, size_t __n)
80f41baa 44 __attribute_pure__;
bd7f30a9 45
7b037c09
ZW
46extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
47
bd7f30a9
AJ
48extern int __ffs (int __i) __attribute__ ((const));
49
50extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
51
16396c41
L
52/* Get _STRING_ARCH_unaligned. */
53#include <string_private.h>
7c3018f9 54#endif
16396c41 55
8d2d51e3 56#include <string/string.h>
5a3fba99 57
7c3018f9 58#ifndef _ISOMAC
da4cfe38
RM
59extern __typeof (strcoll_l) __strcoll_l;
60extern __typeof (strxfrm_l) __strxfrm_l;
61extern __typeof (strcasecmp_l) __strcasecmp_l;
62extern __typeof (strncasecmp_l) __strncasecmp_l;
63
5a3fba99 64/* Alternative version which doesn't pollute glibc's namespace. */
4f41c682 65#if IS_IN (libc)
23691ab2
UD
66# undef strndupa
67# define strndupa(s, n) \
5a3fba99
UD
68 (__extension__ \
69 ({ \
a784e502 70 const char *__old = (s); \
5a3fba99
UD
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 }))
23691ab2 76#endif
37ba7d66
UD
77
78libc_hidden_proto (__mempcpy)
09a596cc
ZW
79#ifndef __NO_STRING_INLINES
80# define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n)
81#endif
6111cd0e 82libc_hidden_proto (__stpcpy)
09a596cc
ZW
83#ifndef __NO_STRING_INLINES
84# define __stpcpy(dest, src) __builtin_stpcpy (dest, src)
85#endif
37ba7d66
UD
86libc_hidden_proto (__stpncpy)
87libc_hidden_proto (__rawmemchr)
88libc_hidden_proto (__strcasecmp)
5b070c75
UD
89libc_hidden_proto (__strcasecmp_l)
90libc_hidden_proto (__strncasecmp_l)
09a596cc
ZW
91extern __typeof (strncat) __strncat;
92libc_hidden_proto (__strncat)
5b070c75
UD
93libc_hidden_proto (__strdup)
94libc_hidden_proto (__strndup)
95libc_hidden_proto (__strerror_r)
a20d8dbe 96libc_hidden_proto (__strverscmp)
7a8bdff0 97libc_hidden_proto (basename)
cf06a4e3
JM
98extern char *__basename (const char *__filename) __THROW __nonnull ((1));
99libc_hidden_proto (__basename)
df962917 100libc_hidden_proto (strcoll)
ccadf7b5
UD
101libc_hidden_proto (__strcoll_l)
102libc_hidden_proto (__strxfrm_l)
ee600e3f 103libc_hidden_proto (__strtok_r)
a784e502 104extern char *__strsep_g (char **__stringp, const char *__delim);
ee600e3f 105libc_hidden_proto (__strsep_g)
710af5d7 106libc_hidden_proto (strnlen)
17696087 107libc_hidden_proto (__strnlen)
ca38dc17 108libc_hidden_proto (memmem)
9975e3d3
JM
109extern __typeof (memmem) __memmem;
110libc_hidden_proto (__memmem)
5bb43a43 111libc_hidden_proto (__ffs)
9b0b40d3 112
ea1bd74d
ZW
113#if IS_IN (libc)
114/* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk. */
115void __explicit_bzero_chk_internal (void *, size_t, size_t)
116 __THROW __nonnull ((1)) attribute_hidden;
117# define explicit_bzero(buf, len) \
118 __explicit_bzero_chk_internal (buf, len, __bos0 (buf))
119#elif !IS_IN (nonlib)
120void __explicit_bzero_chk (void *, size_t, size_t) __THROW __nonnull ((1));
121# define explicit_bzero(buf, len) __explicit_bzero_chk (buf, len, __bos0 (buf))
122#endif
123
85dd1003
UD
124libc_hidden_builtin_proto (memchr)
125libc_hidden_builtin_proto (memcpy)
4a691b06 126libc_hidden_builtin_proto (mempcpy)
758b2153 127libc_hidden_builtin_proto (memcmp)
85dd1003
UD
128libc_hidden_builtin_proto (memmove)
129libc_hidden_builtin_proto (memset)
130libc_hidden_builtin_proto (strcat)
131libc_hidden_builtin_proto (strchr)
132libc_hidden_builtin_proto (strcmp)
133libc_hidden_builtin_proto (strcpy)
134libc_hidden_builtin_proto (strcspn)
135libc_hidden_builtin_proto (strlen)
136libc_hidden_builtin_proto (strncmp)
137libc_hidden_builtin_proto (strncpy)
138libc_hidden_builtin_proto (strpbrk)
4a691b06 139libc_hidden_builtin_proto (stpcpy)
85dd1003
UD
140libc_hidden_builtin_proto (strrchr)
141libc_hidden_builtin_proto (strspn)
142libc_hidden_builtin_proto (strstr)
2dd18ce2 143libc_hidden_builtin_proto (ffs)
85dd1003 144
f8411468
L
145#if IS_IN (rtld)
146extern __typeof (__stpcpy) __stpcpy attribute_hidden;
147extern __typeof (__strdup) __strdup attribute_hidden;
148extern __typeof (__strerror_r) __strerror_r attribute_hidden;
149extern __typeof (__strsep_g) __strsep_g attribute_hidden;
150
151extern __typeof (memchr) memchr attribute_hidden;
152extern __typeof (memcmp) memcmp attribute_hidden;
153extern __typeof (memcpy) memcpy attribute_hidden;
154extern __typeof (memmove) memmove attribute_hidden;
155extern __typeof (memset) memset attribute_hidden;
156extern __typeof (rawmemchr) rawmemchr attribute_hidden;
157extern __typeof (stpcpy) stpcpy attribute_hidden;
158extern __typeof (strchr) strchr attribute_hidden;
159extern __typeof (strcmp) strcmp attribute_hidden;
160extern __typeof (strlen) strlen attribute_hidden;
161extern __typeof (strnlen) strnlen attribute_hidden;
162extern __typeof (strsep) strsep attribute_hidden;
163#endif
164
4f41c682 165#if (!IS_IN (libc) || !defined SHARED) \
c1b0aadc 166 && !defined NO_MEMPCPY_STPCPY_REDIRECT
939da411
JM
167/* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
168 __mempcpy and __stpcpy if not inlined. */
169extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
170extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
171#endif
172
b5cc329c
UD
173extern void *__memcpy_chk (void *__restrict __dest,
174 const void *__restrict __src, size_t __len,
175 size_t __destlen) __THROW;
176extern void *__memmove_chk (void *__dest, const void *__src, size_t __len,
177 size_t __destlen) __THROW;
178extern void *__mempcpy_chk (void *__restrict __dest,
179 const void *__restrict __src, size_t __len,
180 size_t __destlen) __THROW;
181extern void *__memset_chk (void *__dest, int __ch, size_t __len,
182 size_t __destlen) __THROW;
183extern char *__strcpy_chk (char *__restrict __dest,
184 const char *__restrict __src,
185 size_t __destlen) __THROW;
186extern char *__stpcpy_chk (char *__restrict __dest,
187 const char *__restrict __src,
188 size_t __destlen) __THROW;
189extern char *__strncpy_chk (char *__restrict __dest,
190 const char *__restrict __src,
191 size_t __len, size_t __destlen) __THROW;
192extern char *__strcat_chk (char *__restrict __dest,
193 const char *__restrict __src,
194 size_t __destlen) __THROW;
195extern char *__strncat_chk (char *__restrict __dest,
196 const char *__restrict __src,
197 size_t __len, size_t __destlen) __THROW;
31341567 198#endif
b5cc329c 199
9b0b40d3 200#endif