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