123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660 |
- #ifndef _STRING_H
- #define _STRING_H 1
- #include <features.h>
- __BEGIN_DECLS
- #define __need_size_t
- #define __need_NULL
- #include <stddef.h>
- #if defined __cplusplus && __GNUC_PREREQ (4, 4)
- # define __CORRECT_ISO_CPP_STRING_H_PROTO
- #endif
- __BEGIN_NAMESPACE_STD
- extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
- size_t __n) __THROW __nonnull ((1, 2));
- extern void *memmove (void *__dest, const void *__src, size_t __n)
- __THROW __nonnull ((1, 2));
- __END_NAMESPACE_STD
- #if defined __USE_MISC || defined __USE_XOPEN
- extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
- int __c, size_t __n)
- __THROW __nonnull ((1, 2));
- #endif
- __BEGIN_NAMESPACE_STD
- extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
- extern int memcmp (const void *__s1, const void *__s2, size_t __n)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++"
- {
- extern void *memchr (void *__s, int __c, size_t __n)
- __THROW __asm ("memchr") __attribute_pure__ __nonnull ((1));
- extern const void *memchr (const void *__s, int __c, size_t __n)
- __THROW __asm ("memchr") __attribute_pure__ __nonnull ((1));
- # ifdef __OPTIMIZE__
- __extern_always_inline void *
- memchr (void *__s, int __c, size_t __n) __THROW
- {
- return __builtin_memchr (__s, __c, __n);
- }
- __extern_always_inline const void *
- memchr (const void *__s, int __c, size_t __n) __THROW
- {
- return __builtin_memchr (__s, __c, __n);
- }
- # endif
- }
- #else
- extern void *memchr (const void *__s, int __c, size_t __n)
- __THROW __attribute_pure__ __nonnull ((1));
- #endif
- __END_NAMESPACE_STD
- #ifdef __USE_GNU
- # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++" void *rawmemchr (void *__s, int __c)
- __THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1));
- extern "C++" const void *rawmemchr (const void *__s, int __c)
- __THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1));
- # else
- extern void *rawmemchr (const void *__s, int __c)
- __THROW __attribute_pure__ __nonnull ((1));
- # endif
- # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++" void *memrchr (void *__s, int __c, size_t __n)
- __THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1));
- extern "C++" const void *memrchr (const void *__s, int __c, size_t __n)
- __THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1));
- # else
- extern void *memrchr (const void *__s, int __c, size_t __n)
- __THROW __attribute_pure__ __nonnull ((1));
- # endif
- #endif
- __BEGIN_NAMESPACE_STD
- extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
- __THROW __nonnull ((1, 2));
- extern char *strncpy (char *__restrict __dest,
- const char *__restrict __src, size_t __n)
- __THROW __nonnull ((1, 2));
- extern char *strcat (char *__restrict __dest, const char *__restrict __src)
- __THROW __nonnull ((1, 2));
- extern char *strncat (char *__restrict __dest, const char *__restrict __src,
- size_t __n) __THROW __nonnull ((1, 2));
- extern int strcmp (const char *__s1, const char *__s2)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- extern int strncmp (const char *__s1, const char *__s2, size_t __n)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- extern int strcoll (const char *__s1, const char *__s2)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- extern size_t strxfrm (char *__restrict __dest,
- const char *__restrict __src, size_t __n)
- __THROW __nonnull ((2));
- __END_NAMESPACE_STD
- #ifdef __USE_XOPEN2K8
- # include <xlocale.h>
- extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l)
- __THROW __attribute_pure__ __nonnull ((1, 2, 3));
- extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
- __locale_t __l) __THROW __nonnull ((2, 4));
- #endif
- #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
- extern char *strdup (const char *__s)
- __THROW __attribute_malloc__ __nonnull ((1));
- #endif
- #if defined __USE_XOPEN2K8
- extern char *strndup (const char *__string, size_t __n)
- __THROW __attribute_malloc__ __nonnull ((1));
- #endif
- #if defined __USE_GNU && defined __GNUC__
- # define strdupa(s) \
- (__extension__ \
- ({ \
- const char *__old = (s); \
- size_t __len = strlen (__old) + 1; \
- char *__new = (char *) __builtin_alloca (__len); \
- (char *) memcpy (__new, __old, __len); \
- }))
- # define strndupa(s, n) \
- (__extension__ \
- ({ \
- const char *__old = (s); \
- size_t __len = strnlen (__old, (n)); \
- char *__new = (char *) __builtin_alloca (__len + 1); \
- __new[__len] = '\0'; \
- (char *) memcpy (__new, __old, __len); \
- }))
- #endif
- __BEGIN_NAMESPACE_STD
- #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++"
- {
- extern char *strchr (char *__s, int __c)
- __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));
- extern const char *strchr (const char *__s, int __c)
- __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));
- # ifdef __OPTIMIZE__
- __extern_always_inline char *
- strchr (char *__s, int __c) __THROW
- {
- return __builtin_strchr (__s, __c);
- }
- __extern_always_inline const char *
- strchr (const char *__s, int __c) __THROW
- {
- return __builtin_strchr (__s, __c);
- }
- # endif
- }
- #else
- extern char *strchr (const char *__s, int __c)
- __THROW __attribute_pure__ __nonnull ((1));
- #endif
- #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++"
- {
- extern char *strrchr (char *__s, int __c)
- __THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1));
- extern const char *strrchr (const char *__s, int __c)
- __THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1));
- # ifdef __OPTIMIZE__
- __extern_always_inline char *
- strrchr (char *__s, int __c) __THROW
- {
- return __builtin_strrchr (__s, __c);
- }
- __extern_always_inline const char *
- strrchr (const char *__s, int __c) __THROW
- {
- return __builtin_strrchr (__s, __c);
- }
- # endif
- }
- #else
- extern char *strrchr (const char *__s, int __c)
- __THROW __attribute_pure__ __nonnull ((1));
- #endif
- __END_NAMESPACE_STD
- #ifdef __USE_GNU
- # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++" char *strchrnul (char *__s, int __c)
- __THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1));
- extern "C++" const char *strchrnul (const char *__s, int __c)
- __THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1));
- # else
- extern char *strchrnul (const char *__s, int __c)
- __THROW __attribute_pure__ __nonnull ((1));
- # endif
- #endif
- __BEGIN_NAMESPACE_STD
- extern size_t strcspn (const char *__s, const char *__reject)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- extern size_t strspn (const char *__s, const char *__accept)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++"
- {
- extern char *strpbrk (char *__s, const char *__accept)
- __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
- extern const char *strpbrk (const char *__s, const char *__accept)
- __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
- # ifdef __OPTIMIZE__
- __extern_always_inline char *
- strpbrk (char *__s, const char *__accept) __THROW
- {
- return __builtin_strpbrk (__s, __accept);
- }
- __extern_always_inline const char *
- strpbrk (const char *__s, const char *__accept) __THROW
- {
- return __builtin_strpbrk (__s, __accept);
- }
- # endif
- }
- #else
- extern char *strpbrk (const char *__s, const char *__accept)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- #endif
- #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++"
- {
- extern char *strstr (char *__haystack, const char *__needle)
- __THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
- extern const char *strstr (const char *__haystack, const char *__needle)
- __THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
- # ifdef __OPTIMIZE__
- __extern_always_inline char *
- strstr (char *__haystack, const char *__needle) __THROW
- {
- return __builtin_strstr (__haystack, __needle);
- }
- __extern_always_inline const char *
- strstr (const char *__haystack, const char *__needle) __THROW
- {
- return __builtin_strstr (__haystack, __needle);
- }
- # endif
- }
- #else
- extern char *strstr (const char *__haystack, const char *__needle)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- #endif
- extern char *strtok (char *__restrict __s, const char *__restrict __delim)
- __THROW __nonnull ((2));
- __END_NAMESPACE_STD
- extern char *__strtok_r (char *__restrict __s,
- const char *__restrict __delim,
- char **__restrict __save_ptr)
- __THROW __nonnull ((2, 3));
- #ifdef __USE_POSIX
- extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
- char **__restrict __save_ptr)
- __THROW __nonnull ((2, 3));
- #endif
- #ifdef __USE_GNU
- # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++" char *strcasestr (char *__haystack, const char *__needle)
- __THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2));
- extern "C++" const char *strcasestr (const char *__haystack,
- const char *__needle)
- __THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2));
- # else
- extern char *strcasestr (const char *__haystack, const char *__needle)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- # endif
- #endif
- #ifdef __USE_GNU
- extern void *memmem (const void *__haystack, size_t __haystacklen,
- const void *__needle, size_t __needlelen)
- __THROW __attribute_pure__ __nonnull ((1, 3));
- extern void *__mempcpy (void *__restrict __dest,
- const void *__restrict __src, size_t __n)
- __THROW __nonnull ((1, 2));
- extern void *mempcpy (void *__restrict __dest,
- const void *__restrict __src, size_t __n)
- __THROW __nonnull ((1, 2));
- #endif
- __BEGIN_NAMESPACE_STD
- extern size_t strlen (const char *__s)
- __THROW __attribute_pure__ __nonnull ((1));
- __END_NAMESPACE_STD
- #ifdef __USE_XOPEN2K8
- extern size_t strnlen (const char *__string, size_t __maxlen)
- __THROW __attribute_pure__ __nonnull ((1));
- #endif
- __BEGIN_NAMESPACE_STD
- extern char *strerror (int __errnum) __THROW;
- __END_NAMESPACE_STD
- #ifdef __USE_XOPEN2K
- # if defined __USE_XOPEN2K && !defined __USE_GNU
- # ifdef __REDIRECT_NTH
- extern int __REDIRECT_NTH (strerror_r,
- (int __errnum, char *__buf, size_t __buflen),
- __xpg_strerror_r) __nonnull ((2));
- # else
- extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
- __THROW __nonnull ((2));
- # define strerror_r __xpg_strerror_r
- # endif
- # else
- extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
- __THROW __nonnull ((2)) __wur;
- # endif
- #endif
- #ifdef __USE_XOPEN2K8
- extern char *strerror_l (int __errnum, __locale_t __l) __THROW;
- #endif
- extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
- #ifdef __USE_MISC
- extern void bcopy (const void *__src, void *__dest, size_t __n)
- __THROW __nonnull ((1, 2));
- extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
- extern int bcmp (const void *__s1, const void *__s2, size_t __n)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++"
- {
- extern char *index (char *__s, int __c)
- __THROW __asm ("index") __attribute_pure__ __nonnull ((1));
- extern const char *index (const char *__s, int __c)
- __THROW __asm ("index") __attribute_pure__ __nonnull ((1));
- # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRINGS_H_PROTO
- __extern_always_inline char *
- index (char *__s, int __c) __THROW
- {
- return __builtin_index (__s, __c);
- }
- __extern_always_inline const char *
- index (const char *__s, int __c) __THROW
- {
- return __builtin_index (__s, __c);
- }
- # endif
- }
- # else
- extern char *index (const char *__s, int __c)
- __THROW __attribute_pure__ __nonnull ((1));
- # endif
- # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++"
- {
- extern char *rindex (char *__s, int __c)
- __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1));
- extern const char *rindex (const char *__s, int __c)
- __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1));
- # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRINGS_H_PROTO
- __extern_always_inline char *
- rindex (char *__s, int __c) __THROW
- {
- return __builtin_rindex (__s, __c);
- }
- __extern_always_inline const char *
- rindex (const char *__s, int __c) __THROW
- {
- return __builtin_rindex (__s, __c);
- }
- #endif
- }
- # else
- extern char *rindex (const char *__s, int __c)
- __THROW __attribute_pure__ __nonnull ((1));
- # endif
- extern int ffs (int __i) __THROW __attribute__ ((__const__));
- # ifdef __USE_GNU
- extern int ffsl (long int __l) __THROW __attribute__ ((__const__));
- __extension__ extern int ffsll (long long int __ll)
- __THROW __attribute__ ((__const__));
- # endif
- extern int strcasecmp (const char *__s1, const char *__s2)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- #endif
- #ifdef __USE_GNU
- extern int strcasecmp_l (const char *__s1, const char *__s2,
- __locale_t __loc)
- __THROW __attribute_pure__ __nonnull ((1, 2, 3));
- extern int strncasecmp_l (const char *__s1, const char *__s2,
- size_t __n, __locale_t __loc)
- __THROW __attribute_pure__ __nonnull ((1, 2, 4));
- #endif
- #ifdef __USE_MISC
- extern char *strsep (char **__restrict __stringp,
- const char *__restrict __delim)
- __THROW __nonnull ((1, 2));
- #endif
- #ifdef __USE_XOPEN2K8
- extern char *strsignal (int __sig) __THROW;
- extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
- __THROW __nonnull ((1, 2));
- extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
- __THROW __nonnull ((1, 2));
- extern char *__stpncpy (char *__restrict __dest,
- const char *__restrict __src, size_t __n)
- __THROW __nonnull ((1, 2));
- extern char *stpncpy (char *__restrict __dest,
- const char *__restrict __src, size_t __n)
- __THROW __nonnull ((1, 2));
- #endif
- #ifdef __USE_GNU
- extern int strverscmp (const char *__s1, const char *__s2)
- __THROW __attribute_pure__ __nonnull ((1, 2));
- extern char *strfry (char *__string) __THROW __nonnull ((1));
- extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1));
- # ifndef basename
- # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
- extern "C++" char *basename (char *__filename)
- __THROW __asm ("basename") __nonnull ((1));
- extern "C++" const char *basename (const char *__filename)
- __THROW __asm ("basename") __nonnull ((1));
- # else
- extern char *basename (const char *__filename) __THROW __nonnull ((1));
- # endif
- # endif
- #endif
- #if defined __GNUC__ && __GNUC__ >= 2
- # if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
- && !defined __NO_INLINE__ && !defined __cplusplus
- # include <bits/string.h>
- # include <bits/string2.h>
- # endif
- # if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
- # include <bits/string3.h>
- # endif
- #endif
- #if defined __USE_GNU && defined __OPTIMIZE__ \
- && defined __extern_always_inline && __GNUC_PREREQ (3,2)
- # if !defined _FORCE_INLINES && !defined _HAVE_STRING_ARCH_mempcpy
- #undef mempcpy
- #undef __mempcpy
- #define mempcpy(dest, src, n) __mempcpy_inline (dest, src, n)
- #define __mempcpy(dest, src, n) __mempcpy_inline (dest, src, n)
- __extern_always_inline void *
- __mempcpy_inline (void *__restrict __dest,
- const void *__restrict __src, size_t __n)
- {
- return (char *) memcpy (__dest, __src, __n) + __n;
- }
- # endif
- #endif
- __END_DECLS
- #endif
|