version 1.1.1.2, 2012/05/29 09:29:43
|
version 1.1.1.3, 2021/03/17 13:38:46
|
Line 1
|
Line 1
|
/* A GNU-like <string.h>. |
/* A GNU-like <string.h>. |
|
|
Copyright (C) 1995-1996, 2001-2011 Free Software Foundation, Inc. | Copyright (C) 1995-1996, 2001-2019 Free Software Foundation, Inc. |
|
|
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
Line 13
|
Line 13
|
GNU General Public License for more details. |
GNU General Public License for more details. |
|
|
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software Foundation, | along with this program; if not, see <https://www.gnu.org/licenses/>. */ |
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
|
|
#ifndef _@GUARD_PREFIX@_STRING_H |
|
|
|
#if __GNUC__ >= 3 |
#if __GNUC__ >= 3 |
@PRAGMA_SYSTEM_HEADER@ |
@PRAGMA_SYSTEM_HEADER@ |
#endif |
#endif |
@PRAGMA_COLUMNS@ |
@PRAGMA_COLUMNS@ |
|
|
|
#if defined _GL_ALREADY_INCLUDING_STRING_H |
|
/* Special invocation convention: |
|
- On OS X/NetBSD we have a sequence of nested includes |
|
<string.h> -> <strings.h> -> "string.h" |
|
In this situation system _chk variants due to -D_FORTIFY_SOURCE |
|
might be used after any replacements defined here. */ |
|
|
|
#@INCLUDE_NEXT@ @NEXT_STRING_H@ |
|
|
|
#else |
|
/* Normal invocation convention. */ |
|
|
|
#ifndef _@GUARD_PREFIX@_STRING_H |
|
|
|
#define _GL_ALREADY_INCLUDING_STRING_H |
|
|
/* The include_next requires a split double-inclusion guard. */ |
/* The include_next requires a split double-inclusion guard. */ |
#@INCLUDE_NEXT@ @NEXT_STRING_H@ |
#@INCLUDE_NEXT@ @NEXT_STRING_H@ |
|
|
|
#undef _GL_ALREADY_INCLUDING_STRING_H |
|
|
#ifndef _@GUARD_PREFIX@_STRING_H |
#ifndef _@GUARD_PREFIX@_STRING_H |
#define _@GUARD_PREFIX@_STRING_H |
#define _@GUARD_PREFIX@_STRING_H |
|
|
Line 59
|
Line 74
|
/* The definition of _GL_WARN_ON_USE is copied here. */ |
/* The definition of _GL_WARN_ON_USE is copied here. */ |
|
|
|
|
|
/* Clear a block of memory. The compiler will not delete a call to |
|
this function, even if the block is dead after the call. */ |
|
#if @GNULIB_EXPLICIT_BZERO@ |
|
# if ! @HAVE_EXPLICIT_BZERO@ |
|
_GL_FUNCDECL_SYS (explicit_bzero, void, |
|
(void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); |
|
# endif |
|
_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); |
|
_GL_CXXALIASWARN (explicit_bzero); |
|
#elif defined GNULIB_POSIXCHECK |
|
# undef explicit_bzero |
|
# if HAVE_RAW_DECL_EXPLICIT_BZERO |
|
_GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " |
|
"use gnulib module explicit_bzero for portability"); |
|
# endif |
|
#endif |
|
|
/* Find the index of the least-significant set bit. */ |
/* Find the index of the least-significant set bit. */ |
#if @GNULIB_FFSL@ |
#if @GNULIB_FFSL@ |
# if !@HAVE_FFSL@ |
# if !@HAVE_FFSL@ |
Line 401 _GL_WARN_ON_USE (strncat, "strncat is unportable - "
|
Line 433 _GL_WARN_ON_USE (strncat, "strncat is unportable - "
|
# undef strndup |
# undef strndup |
# define strndup rpl_strndup |
# define strndup rpl_strndup |
# endif |
# endif |
_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) | _GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n) |
_GL_ARG_NONNULL ((1))); |
_GL_ARG_NONNULL ((1))); |
_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); | _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); |
# else |
# else |
# if ! @HAVE_DECL_STRNDUP@ |
# if ! @HAVE_DECL_STRNDUP@ |
_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) | _GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n) |
_GL_ARG_NONNULL ((1))); |
_GL_ARG_NONNULL ((1))); |
# endif |
# endif |
_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); | _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); |
# endif |
# endif |
_GL_CXXALIASWARN (strndup); |
_GL_CXXALIASWARN (strndup); |
#elif defined GNULIB_POSIXCHECK |
#elif defined GNULIB_POSIXCHECK |
Line 429 _GL_WARN_ON_USE (strndup, "strndup is unportable - "
|
Line 461 _GL_WARN_ON_USE (strndup, "strndup is unportable - "
|
# undef strnlen |
# undef strnlen |
# define strnlen rpl_strnlen |
# define strnlen rpl_strnlen |
# endif |
# endif |
_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) | _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) |
_GL_ATTRIBUTE_PURE |
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1))); |
_GL_ARG_NONNULL ((1))); |
_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); | _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); |
# else |
# else |
# if ! @HAVE_DECL_STRNLEN@ |
# if ! @HAVE_DECL_STRNLEN@ |
_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) | _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) |
_GL_ATTRIBUTE_PURE |
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1))); |
_GL_ARG_NONNULL ((1))); |
# endif |
# endif |
_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); | _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); |
# endif |
# endif |
_GL_CXXALIASWARN (strnlen); |
_GL_CXXALIASWARN (strnlen); |
#elif defined GNULIB_POSIXCHECK |
#elif defined GNULIB_POSIXCHECK |
Line 725 _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
|
Line 757 _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
# define mbslen rpl_mbslen |
# define mbslen rpl_mbslen |
# endif |
# endif |
_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); | _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) |
| _GL_ATTRIBUTE_PURE |
| _GL_ARG_NONNULL ((1))); |
_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); |
_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); |
# else |
# else |
_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); | _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) |
| _GL_ATTRIBUTE_PURE |
| _GL_ARG_NONNULL ((1))); |
_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); |
_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); |
# endif |
# endif |
_GL_CXXALIASWARN (mbslen); |
_GL_CXXALIASWARN (mbslen); |
Line 738 _GL_CXXALIASWARN (mbslen);
|
Line 774 _GL_CXXALIASWARN (mbslen);
|
/* Return the number of multibyte characters in the character string starting |
/* Return the number of multibyte characters in the character string starting |
at STRING and ending at STRING + LEN. */ |
at STRING and ending at STRING + LEN. */ |
_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) |
_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1)); |
_GL_ARG_NONNULL ((1)); |
#endif |
#endif |
|
|
Line 751 _GL_EXTERN_C size_t mbsnlen (const char *string, size_
|
Line 788 _GL_EXTERN_C size_t mbsnlen (const char *string, size_
|
# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ |
# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ |
# endif |
# endif |
_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) |
_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1))); |
_GL_ARG_NONNULL ((1))); |
_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); |
_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); |
# else |
# else |
_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) |
_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1))); |
_GL_ARG_NONNULL ((1))); |
_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); |
_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); |
# endif |
# endif |
Line 771 _GL_CXXALIASWARN (mbschr);
|
Line 810 _GL_CXXALIASWARN (mbschr);
|
# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ |
# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ |
# endif |
# endif |
_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) |
_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1))); |
_GL_ARG_NONNULL ((1))); |
_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); |
_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); |
# else |
# else |
_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) |
_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1))); |
_GL_ARG_NONNULL ((1))); |
_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); |
_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); |
# endif |
# endif |
Line 787 _GL_CXXALIASWARN (mbsrchr);
|
Line 828 _GL_CXXALIASWARN (mbsrchr);
|
Unlike strstr(), this function works correctly in multibyte locales with |
Unlike strstr(), this function works correctly in multibyte locales with |
encodings different from UTF-8. */ |
encodings different from UTF-8. */ |
_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) |
_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2)); |
_GL_ARG_NONNULL ((1, 2)); |
#endif |
#endif |
|
|
Line 798 _GL_EXTERN_C char * mbsstr (const char *haystack, cons
|
Line 840 _GL_EXTERN_C char * mbsstr (const char *haystack, cons
|
different lengths! |
different lengths! |
Unlike strcasecmp(), this function works correctly in multibyte locales. */ |
Unlike strcasecmp(), this function works correctly in multibyte locales. */ |
_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) |
_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2)); |
_GL_ARG_NONNULL ((1, 2)); |
#endif |
#endif |
|
|
Line 812 _GL_EXTERN_C int mbscasecmp (const char *s1, const cha
|
Line 855 _GL_EXTERN_C int mbscasecmp (const char *s1, const cha
|
Unlike strncasecmp(), this function works correctly in multibyte locales. |
Unlike strncasecmp(), this function works correctly in multibyte locales. |
But beware that N is not a byte count but a character count! */ |
But beware that N is not a byte count but a character count! */ |
_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) |
_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2)); |
_GL_ARG_NONNULL ((1, 2)); |
#endif |
#endif |
|
|
Line 825 _GL_EXTERN_C int mbsncasecmp (const char *s1, const ch
|
Line 869 _GL_EXTERN_C int mbsncasecmp (const char *s1, const ch
|
Unlike strncasecmp(), this function works correctly in multibyte |
Unlike strncasecmp(), this function works correctly in multibyte |
locales. */ |
locales. */ |
_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) |
_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2)); |
_GL_ARG_NONNULL ((1, 2)); |
#endif |
#endif |
|
|
Line 835 _GL_EXTERN_C char * mbspcasecmp (const char *string, c
|
Line 880 _GL_EXTERN_C char * mbspcasecmp (const char *string, c
|
strlen (haystack) < strlen (needle) ! |
strlen (haystack) < strlen (needle) ! |
Unlike strcasestr(), this function works correctly in multibyte locales. */ |
Unlike strcasestr(), this function works correctly in multibyte locales. */ |
_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) |
_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2)); |
_GL_ARG_NONNULL ((1, 2)); |
#endif |
#endif |
|
|
Line 845 _GL_EXTERN_C char * mbscasestr (const char *haystack,
|
Line 891 _GL_EXTERN_C char * mbscasestr (const char *haystack,
|
if none exists. |
if none exists. |
Unlike strcspn(), this function works correctly in multibyte locales. */ |
Unlike strcspn(), this function works correctly in multibyte locales. */ |
_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) |
_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2)); |
_GL_ARG_NONNULL ((1, 2)); |
#endif |
#endif |
|
|
Line 858 _GL_EXTERN_C size_t mbscspn (const char *string, const
|
Line 905 _GL_EXTERN_C size_t mbscspn (const char *string, const
|
# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ |
# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ |
# endif |
# endif |
_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) |
_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2))); |
_GL_ARG_NONNULL ((1, 2))); |
_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); |
_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); |
# else |
# else |
_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) |
_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2))); |
_GL_ARG_NONNULL ((1, 2))); |
_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); |
_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); |
# endif |
# endif |
Line 875 _GL_CXXALIASWARN (mbspbrk);
|
Line 924 _GL_CXXALIASWARN (mbspbrk);
|
if none exists. |
if none exists. |
Unlike strspn(), this function works correctly in multibyte locales. */ |
Unlike strspn(), this function works correctly in multibyte locales. */ |
_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) |
_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2)); |
_GL_ARG_NONNULL ((1, 2)); |
#endif |
#endif |
|
|
Line 994 _GL_WARN_ON_USE (strsignal, "strsignal is unportable -
|
Line 1044 _GL_WARN_ON_USE (strsignal, "strsignal is unportable -
|
#if @GNULIB_STRVERSCMP@ |
#if @GNULIB_STRVERSCMP@ |
# if !@HAVE_STRVERSCMP@ |
# if !@HAVE_STRVERSCMP@ |
_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) |
_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) |
|
_GL_ATTRIBUTE_PURE |
_GL_ARG_NONNULL ((1, 2))); |
_GL_ARG_NONNULL ((1, 2))); |
# endif |
# endif |
_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); |
_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); |
Line 1009 _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable
|
Line 1060 _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable
|
|
|
#endif /* _@GUARD_PREFIX@_STRING_H */ |
#endif /* _@GUARD_PREFIX@_STRING_H */ |
#endif /* _@GUARD_PREFIX@_STRING_H */ |
#endif /* _@GUARD_PREFIX@_STRING_H */ |
|
#endif |