diff options
Diffstat (limited to 'gl/string.in.h')
| -rw-r--r-- | gl/string.in.h | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/gl/string.in.h b/gl/string.in.h index 25e6a087..b54ec0ca 100644 --- a/gl/string.in.h +++ b/gl/string.in.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* A GNU-like <string.h>. | 1 | /* A GNU-like <string.h>. |
| 2 | 2 | ||
| 3 | Copyright (C) 1995-1996, 2001-2025 Free Software Foundation, Inc. | 3 | Copyright (C) 1995-1996, 2001-2026 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
| @@ -80,6 +80,12 @@ | |||
| 80 | # include <strings.h> | 80 | # include <strings.h> |
| 81 | #endif | 81 | #endif |
| 82 | 82 | ||
| 83 | _GL_INLINE_HEADER_BEGIN | ||
| 84 | |||
| 85 | #ifndef _GL_STRING_INLINE | ||
| 86 | # define _GL_STRING_INLINE _GL_INLINE | ||
| 87 | #endif | ||
| 88 | |||
| 83 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers | 89 | /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers |
| 84 | that can be freed by passing them as the Ith argument to the | 90 | that can be freed by passing them as the Ith argument to the |
| 85 | function F. */ | 91 | function F. */ |
| @@ -96,7 +102,7 @@ | |||
| 96 | /* Applies to: functions. Cannot be used on inline functions. */ | 102 | /* Applies to: functions. Cannot be used on inline functions. */ |
| 97 | #ifndef _GL_ATTRIBUTE_DEALLOC_FREE | 103 | #ifndef _GL_ATTRIBUTE_DEALLOC_FREE |
| 98 | # if defined __cplusplus && defined __GNUC__ && !defined __clang__ | 104 | # if defined __cplusplus && defined __GNUC__ && !defined __clang__ |
| 99 | /* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ | 105 | /* Work around GCC bug <https://gcc.gnu.org/PR108231> */ |
| 100 | # define _GL_ATTRIBUTE_DEALLOC_FREE \ | 106 | # define _GL_ATTRIBUTE_DEALLOC_FREE \ |
| 101 | _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) | 107 | _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) |
| 102 | # else | 108 | # else |
| @@ -306,7 +312,6 @@ _GL_FUNCDECL_SYS (explicit_bzero, void, | |||
| 306 | _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); | 312 | _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); |
| 307 | _GL_CXXALIASWARN (explicit_bzero); | 313 | _GL_CXXALIASWARN (explicit_bzero); |
| 308 | #elif defined GNULIB_POSIXCHECK | 314 | #elif defined GNULIB_POSIXCHECK |
| 309 | # undef explicit_bzero | ||
| 310 | # if HAVE_RAW_DECL_EXPLICIT_BZERO | 315 | # if HAVE_RAW_DECL_EXPLICIT_BZERO |
| 311 | _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " | 316 | _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " |
| 312 | "use gnulib module explicit_bzero for portability"); | 317 | "use gnulib module explicit_bzero for portability"); |
| @@ -322,7 +327,6 @@ _GL_FUNCDECL_SYS (ffsl, int, (long int i), ); | |||
| 322 | _GL_CXXALIAS_SYS (ffsl, int, (long int i)); | 327 | _GL_CXXALIAS_SYS (ffsl, int, (long int i)); |
| 323 | _GL_CXXALIASWARN (ffsl); | 328 | _GL_CXXALIASWARN (ffsl); |
| 324 | #elif defined GNULIB_POSIXCHECK | 329 | #elif defined GNULIB_POSIXCHECK |
| 325 | # undef ffsl | ||
| 326 | # if HAVE_RAW_DECL_FFSL | 330 | # if HAVE_RAW_DECL_FFSL |
| 327 | _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); | 331 | _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); |
| 328 | # endif | 332 | # endif |
| @@ -345,7 +349,6 @@ _GL_CXXALIAS_SYS (ffsll, int, (long long int i)); | |||
| 345 | # endif | 349 | # endif |
| 346 | _GL_CXXALIASWARN (ffsll); | 350 | _GL_CXXALIASWARN (ffsll); |
| 347 | #elif defined GNULIB_POSIXCHECK | 351 | #elif defined GNULIB_POSIXCHECK |
| 348 | # undef ffsll | ||
| 349 | # if HAVE_RAW_DECL_FFSLL | 352 | # if HAVE_RAW_DECL_FFSLL |
| 350 | _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); | 353 | _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); |
| 351 | # endif | 354 | # endif |
| @@ -403,7 +406,6 @@ _GL_CXXALIASWARN1 (memchr, void const *, | |||
| 403 | _GL_CXXALIASWARN (memchr); | 406 | _GL_CXXALIASWARN (memchr); |
| 404 | # endif | 407 | # endif |
| 405 | #elif defined GNULIB_POSIXCHECK | 408 | #elif defined GNULIB_POSIXCHECK |
| 406 | # undef memchr | ||
| 407 | /* Assume memchr is always declared. */ | 409 | /* Assume memchr is always declared. */ |
| 408 | _GL_WARN_ON_USE_CXX (memchr, | 410 | _GL_WARN_ON_USE_CXX (memchr, |
| 409 | const void *, void *, (void const *, int, size_t), | 411 | const void *, void *, (void const *, int, size_t), |
| @@ -411,6 +413,21 @@ _GL_WARN_ON_USE_CXX (memchr, | |||
| 411 | "use gnulib module memchr for portability" ); | 413 | "use gnulib module memchr for portability" ); |
| 412 | #endif | 414 | #endif |
| 413 | 415 | ||
| 416 | /* Are S1 and S2, of size N, bytewise equal? */ | ||
| 417 | #if @GNULIB_STRINGEQ@ && !@HAVE_DECL_MEMEQ@ | ||
| 418 | # ifdef __cplusplus | ||
| 419 | extern "C" { | ||
| 420 | # endif | ||
| 421 | _GL_STRING_INLINE bool | ||
| 422 | memeq (void const *__s1, void const *__s2, size_t __n) | ||
| 423 | { | ||
| 424 | return !memcmp (__s1, __s2, __n); | ||
| 425 | } | ||
| 426 | # ifdef __cplusplus | ||
| 427 | } | ||
| 428 | # endif | ||
| 429 | #endif | ||
| 430 | |||
| 414 | /* Return the first occurrence of NEEDLE in HAYSTACK. */ | 431 | /* Return the first occurrence of NEEDLE in HAYSTACK. */ |
| 415 | #if @GNULIB_MEMMEM@ | 432 | #if @GNULIB_MEMMEM@ |
| 416 | # if @REPLACE_MEMMEM@ | 433 | # if @REPLACE_MEMMEM@ |
| @@ -439,7 +456,6 @@ _GL_CXXALIAS_SYS (memmem, void *, | |||
| 439 | # endif | 456 | # endif |
| 440 | _GL_CXXALIASWARN (memmem); | 457 | _GL_CXXALIASWARN (memmem); |
| 441 | #elif defined GNULIB_POSIXCHECK | 458 | #elif defined GNULIB_POSIXCHECK |
| 442 | # undef memmem | ||
| 443 | # if HAVE_RAW_DECL_MEMMEM | 459 | # if HAVE_RAW_DECL_MEMMEM |
| 444 | _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " | 460 | _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " |
| 445 | "use gnulib module memmem-simple for portability, " | 461 | "use gnulib module memmem-simple for portability, " |
| @@ -477,7 +493,6 @@ _GL_CXXALIAS_SYS (mempcpy, void *, | |||
| 477 | _GL_CXXALIASWARN (mempcpy); | 493 | _GL_CXXALIASWARN (mempcpy); |
| 478 | # endif | 494 | # endif |
| 479 | #elif defined GNULIB_POSIXCHECK | 495 | #elif defined GNULIB_POSIXCHECK |
| 480 | # undef mempcpy | ||
| 481 | # if HAVE_RAW_DECL_MEMPCPY | 496 | # if HAVE_RAW_DECL_MEMPCPY |
| 482 | _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " | 497 | _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " |
| 483 | "use gnulib module mempcpy for portability"); | 498 | "use gnulib module mempcpy for portability"); |
| @@ -510,7 +525,6 @@ _GL_CXXALIASWARN1 (memrchr, void const *, | |||
| 510 | _GL_CXXALIASWARN (memrchr); | 525 | _GL_CXXALIASWARN (memrchr); |
| 511 | # endif | 526 | # endif |
| 512 | #elif defined GNULIB_POSIXCHECK | 527 | #elif defined GNULIB_POSIXCHECK |
| 513 | # undef memrchr | ||
| 514 | # if HAVE_RAW_DECL_MEMRCHR | 528 | # if HAVE_RAW_DECL_MEMRCHR |
| 515 | _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " | 529 | _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " |
| 516 | "use gnulib module memrchr for portability"); | 530 | "use gnulib module memrchr for portability"); |
| @@ -541,7 +555,6 @@ _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); | |||
| 541 | _GL_CXXALIASWARN (memset_explicit); | 555 | _GL_CXXALIASWARN (memset_explicit); |
| 542 | # endif | 556 | # endif |
| 543 | #elif defined GNULIB_POSIXCHECK | 557 | #elif defined GNULIB_POSIXCHECK |
| 544 | # undef memset_explicit | ||
| 545 | # if HAVE_RAW_DECL_MEMSET_EXPLICIT | 558 | # if HAVE_RAW_DECL_MEMSET_EXPLICIT |
| 546 | _GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - " | 559 | _GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - " |
| 547 | "use gnulib module memset_explicit for portability"); | 560 | "use gnulib module memset_explicit for portability"); |
| @@ -576,7 +589,6 @@ _GL_CXXALIASWARN1 (rawmemchr, void const *, | |||
| 576 | _GL_CXXALIASWARN (rawmemchr); | 589 | _GL_CXXALIASWARN (rawmemchr); |
| 577 | # endif | 590 | # endif |
| 578 | #elif defined GNULIB_POSIXCHECK | 591 | #elif defined GNULIB_POSIXCHECK |
| 579 | # undef rawmemchr | ||
| 580 | # if HAVE_RAW_DECL_RAWMEMCHR | 592 | # if HAVE_RAW_DECL_RAWMEMCHR |
| 581 | _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " | 593 | _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " |
| 582 | "use gnulib module rawmemchr for portability"); | 594 | "use gnulib module rawmemchr for portability"); |
| @@ -608,7 +620,6 @@ _GL_CXXALIAS_SYS (stpcpy, char *, | |||
| 608 | _GL_CXXALIASWARN (stpcpy); | 620 | _GL_CXXALIASWARN (stpcpy); |
| 609 | # endif | 621 | # endif |
| 610 | #elif defined GNULIB_POSIXCHECK | 622 | #elif defined GNULIB_POSIXCHECK |
| 611 | # undef stpcpy | ||
| 612 | # if HAVE_RAW_DECL_STPCPY | 623 | # if HAVE_RAW_DECL_STPCPY |
| 613 | _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " | 624 | _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " |
| 614 | "use gnulib module stpcpy for portability"); | 625 | "use gnulib module stpcpy for portability"); |
| @@ -645,7 +656,6 @@ _GL_CXXALIAS_SYS (stpncpy, char *, | |||
| 645 | _GL_CXXALIASWARN (stpncpy); | 656 | _GL_CXXALIASWARN (stpncpy); |
| 646 | # endif | 657 | # endif |
| 647 | #elif defined GNULIB_POSIXCHECK | 658 | #elif defined GNULIB_POSIXCHECK |
| 648 | # undef stpncpy | ||
| 649 | # if HAVE_RAW_DECL_STPNCPY | 659 | # if HAVE_RAW_DECL_STPNCPY |
| 650 | _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " | 660 | _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " |
| 651 | "use gnulib module stpncpy for portability"); | 661 | "use gnulib module stpncpy for portability"); |
| @@ -655,7 +665,6 @@ _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " | |||
| 655 | #if defined GNULIB_POSIXCHECK | 665 | #if defined GNULIB_POSIXCHECK |
| 656 | /* strchr() does not work with multibyte strings if the locale encoding is | 666 | /* strchr() does not work with multibyte strings if the locale encoding is |
| 657 | GB18030 and the character to be searched is a digit. */ | 667 | GB18030 and the character to be searched is a digit. */ |
| 658 | # undef strchr | ||
| 659 | /* Assume strchr is always declared. */ | 668 | /* Assume strchr is always declared. */ |
| 660 | _GL_WARN_ON_USE_CXX (strchr, | 669 | _GL_WARN_ON_USE_CXX (strchr, |
| 661 | const char *, char *, (const char *, int), | 670 | const char *, char *, (const char *, int), |
| @@ -701,7 +710,6 @@ _GL_CXXALIASWARN1 (strchrnul, char const *, | |||
| 701 | _GL_CXXALIASWARN (strchrnul); | 710 | _GL_CXXALIASWARN (strchrnul); |
| 702 | # endif | 711 | # endif |
| 703 | #elif defined GNULIB_POSIXCHECK | 712 | #elif defined GNULIB_POSIXCHECK |
| 704 | # undef strchrnul | ||
| 705 | # if HAVE_RAW_DECL_STRCHRNUL | 713 | # if HAVE_RAW_DECL_STRCHRNUL |
| 706 | _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " | 714 | _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " |
| 707 | "use gnulib module strchrnul for portability"); | 715 | "use gnulib module strchrnul for portability"); |
| @@ -766,7 +774,6 @@ _GL_FUNCDECL_SYS (strdup, char *, | |||
| 766 | # endif | 774 | # endif |
| 767 | # endif | 775 | # endif |
| 768 | # if defined GNULIB_POSIXCHECK | 776 | # if defined GNULIB_POSIXCHECK |
| 769 | # undef strdup | ||
| 770 | # if HAVE_RAW_DECL_STRDUP | 777 | # if HAVE_RAW_DECL_STRDUP |
| 771 | _GL_WARN_ON_USE (strdup, "strdup is unportable - " | 778 | _GL_WARN_ON_USE (strdup, "strdup is unportable - " |
| 772 | "use gnulib module strdup for portability"); | 779 | "use gnulib module strdup for portability"); |
| @@ -791,6 +798,21 @@ _GL_CXXALIASWARN (strdup); | |||
| 791 | # endif | 798 | # endif |
| 792 | #endif | 799 | #endif |
| 793 | 800 | ||
| 801 | /* Are strings S1 and S2 equal? */ | ||
| 802 | #if @GNULIB_STRINGEQ@ && !@HAVE_DECL_STREQ@ | ||
| 803 | # ifdef __cplusplus | ||
| 804 | extern "C" { | ||
| 805 | # endif | ||
| 806 | _GL_STRING_INLINE bool | ||
| 807 | streq (char const *__s1, char const *__s2) | ||
| 808 | { | ||
| 809 | return !strcmp (__s1, __s2); | ||
| 810 | } | ||
| 811 | # ifdef __cplusplus | ||
| 812 | } | ||
| 813 | # endif | ||
| 814 | #endif | ||
| 815 | |||
| 794 | /* Append no more than N characters from SRC onto DEST. */ | 816 | /* Append no more than N characters from SRC onto DEST. */ |
| 795 | #if @GNULIB_STRNCAT@ | 817 | #if @GNULIB_STRNCAT@ |
| 796 | # if @REPLACE_STRNCAT@ | 818 | # if @REPLACE_STRNCAT@ |
| @@ -812,7 +834,6 @@ _GL_CXXALIAS_SYS (strncat, char *, | |||
| 812 | _GL_CXXALIASWARN (strncat); | 834 | _GL_CXXALIASWARN (strncat); |
| 813 | # endif | 835 | # endif |
| 814 | #elif defined GNULIB_POSIXCHECK | 836 | #elif defined GNULIB_POSIXCHECK |
| 815 | # undef strncat | ||
| 816 | # if HAVE_RAW_DECL_STRNCAT | 837 | # if HAVE_RAW_DECL_STRNCAT |
| 817 | _GL_WARN_ON_USE (strncat, "strncat is unportable - " | 838 | _GL_WARN_ON_USE (strncat, "strncat is unportable - " |
| 818 | "use gnulib module strncat for portability"); | 839 | "use gnulib module strncat for portability"); |
| @@ -896,7 +917,6 @@ _GL_FUNCDECL_SYS (strndup, char *, | |||
| 896 | # endif | 917 | # endif |
| 897 | # endif | 918 | # endif |
| 898 | # if defined GNULIB_POSIXCHECK | 919 | # if defined GNULIB_POSIXCHECK |
| 899 | # undef strndup | ||
| 900 | # if HAVE_RAW_DECL_STRNDUP | 920 | # if HAVE_RAW_DECL_STRNDUP |
| 901 | _GL_WARN_ON_USE (strndup, "strndup is unportable - " | 921 | _GL_WARN_ON_USE (strndup, "strndup is unportable - " |
| 902 | "use gnulib module strndup for portability"); | 922 | "use gnulib module strndup for portability"); |
| @@ -927,7 +947,6 @@ _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); | |||
| 927 | # endif | 947 | # endif |
| 928 | _GL_CXXALIASWARN (strnlen); | 948 | _GL_CXXALIASWARN (strnlen); |
| 929 | #elif defined GNULIB_POSIXCHECK | 949 | #elif defined GNULIB_POSIXCHECK |
| 930 | # undef strnlen | ||
| 931 | # if HAVE_RAW_DECL_STRNLEN | 950 | # if HAVE_RAW_DECL_STRNLEN |
| 932 | _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " | 951 | _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " |
| 933 | "use gnulib module strnlen for portability"); | 952 | "use gnulib module strnlen for portability"); |
| @@ -939,7 +958,6 @@ _GL_WARN_ON_USE (strnlen, "strnlen is unportable - " | |||
| 939 | Even in this simple case, it does not work with multibyte strings if the | 958 | Even in this simple case, it does not work with multibyte strings if the |
| 940 | locale encoding is GB18030 and one of the characters to be searched is a | 959 | locale encoding is GB18030 and one of the characters to be searched is a |
| 941 | digit. */ | 960 | digit. */ |
| 942 | # undef strcspn | ||
| 943 | /* Assume strcspn is always declared. */ | 961 | /* Assume strcspn is always declared. */ |
| 944 | _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " | 962 | _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " |
| 945 | "in multibyte locales - " | 963 | "in multibyte locales - " |
| @@ -976,7 +994,6 @@ _GL_CXXALIASWARN (strpbrk); | |||
| 976 | Even in this simple case, it does not work with multibyte strings if the | 994 | Even in this simple case, it does not work with multibyte strings if the |
| 977 | locale encoding is GB18030 and one of the characters to be searched is a | 995 | locale encoding is GB18030 and one of the characters to be searched is a |
| 978 | digit. */ | 996 | digit. */ |
| 979 | # undef strpbrk | ||
| 980 | _GL_WARN_ON_USE_CXX (strpbrk, | 997 | _GL_WARN_ON_USE_CXX (strpbrk, |
| 981 | const char *, char *, (const char *, const char *), | 998 | const char *, char *, (const char *, const char *), |
| 982 | "strpbrk cannot work correctly on character strings " | 999 | "strpbrk cannot work correctly on character strings " |
| @@ -996,7 +1013,6 @@ _GL_WARN_ON_USE_CXX (strpbrk, | |||
| 996 | #if defined GNULIB_POSIXCHECK | 1013 | #if defined GNULIB_POSIXCHECK |
| 997 | /* strspn() assumes the second argument is a list of single-byte characters. | 1014 | /* strspn() assumes the second argument is a list of single-byte characters. |
| 998 | Even in this simple case, it cannot work with multibyte strings. */ | 1015 | Even in this simple case, it cannot work with multibyte strings. */ |
| 999 | # undef strspn | ||
| 1000 | /* Assume strspn is always declared. */ | 1016 | /* Assume strspn is always declared. */ |
| 1001 | _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " | 1017 | _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " |
| 1002 | "in multibyte locales - " | 1018 | "in multibyte locales - " |
| @@ -1006,7 +1022,6 @@ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " | |||
| 1006 | #if defined GNULIB_POSIXCHECK | 1022 | #if defined GNULIB_POSIXCHECK |
| 1007 | /* strrchr() does not work with multibyte strings if the locale encoding is | 1023 | /* strrchr() does not work with multibyte strings if the locale encoding is |
| 1008 | GB18030 and the character to be searched is a digit. */ | 1024 | GB18030 and the character to be searched is a digit. */ |
| 1009 | # undef strrchr | ||
| 1010 | /* Assume strrchr is always declared. */ | 1025 | /* Assume strrchr is always declared. */ |
| 1011 | _GL_WARN_ON_USE_CXX (strrchr, | 1026 | _GL_WARN_ON_USE_CXX (strrchr, |
| 1012 | const char *, char *, (const char *, int), | 1027 | const char *, char *, (const char *, int), |
| @@ -1041,13 +1056,11 @@ _GL_CXXALIAS_SYS (strsep, char *, | |||
| 1041 | (char **restrict __stringp, char const *restrict __delim)); | 1056 | (char **restrict __stringp, char const *restrict __delim)); |
| 1042 | _GL_CXXALIASWARN (strsep); | 1057 | _GL_CXXALIASWARN (strsep); |
| 1043 | # if defined GNULIB_POSIXCHECK | 1058 | # if defined GNULIB_POSIXCHECK |
| 1044 | # undef strsep | ||
| 1045 | _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " | 1059 | _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " |
| 1046 | "in multibyte locales - " | 1060 | "in multibyte locales - " |
| 1047 | "use mbssep if you care about internationalization"); | 1061 | "use mbssep if you care about internationalization"); |
| 1048 | # endif | 1062 | # endif |
| 1049 | #elif defined GNULIB_POSIXCHECK | 1063 | #elif defined GNULIB_POSIXCHECK |
| 1050 | # undef strsep | ||
| 1051 | # if HAVE_RAW_DECL_STRSEP | 1064 | # if HAVE_RAW_DECL_STRSEP |
| 1052 | _GL_WARN_ON_USE (strsep, "strsep is unportable - " | 1065 | _GL_WARN_ON_USE (strsep, "strsep is unportable - " |
| 1053 | "use gnulib module strsep for portability"); | 1066 | "use gnulib module strsep for portability"); |
| @@ -1142,7 +1155,6 @@ _GL_CXXALIASWARN (strcasestr); | |||
| 1142 | /* strcasestr() does not work with multibyte strings: | 1155 | /* strcasestr() does not work with multibyte strings: |
| 1143 | It is a glibc extension, and glibc implements it only for unibyte | 1156 | It is a glibc extension, and glibc implements it only for unibyte |
| 1144 | locales. */ | 1157 | locales. */ |
| 1145 | # undef strcasestr | ||
| 1146 | # if HAVE_RAW_DECL_STRCASESTR | 1158 | # if HAVE_RAW_DECL_STRCASESTR |
| 1147 | _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " | 1159 | _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " |
| 1148 | "strings in multibyte locales - " | 1160 | "strings in multibyte locales - " |
| @@ -1188,7 +1200,7 @@ _GL_CXXALIAS_RPL (strtok_r, char *, | |||
| 1188 | (char *restrict s, char const *restrict delim, | 1200 | (char *restrict s, char const *restrict delim, |
| 1189 | char **restrict save_ptr)); | 1201 | char **restrict save_ptr)); |
| 1190 | # else | 1202 | # else |
| 1191 | # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK | 1203 | # if @UNDEFINE_STRTOK_R@ |
| 1192 | # undef strtok_r | 1204 | # undef strtok_r |
| 1193 | # endif | 1205 | # endif |
| 1194 | # if ! @HAVE_DECL_STRTOK_R@ | 1206 | # if ! @HAVE_DECL_STRTOK_R@ |
| @@ -1208,7 +1220,6 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " | |||
| 1208 | "use mbstok_r if you care about internationalization"); | 1220 | "use mbstok_r if you care about internationalization"); |
| 1209 | # endif | 1221 | # endif |
| 1210 | #elif defined GNULIB_POSIXCHECK | 1222 | #elif defined GNULIB_POSIXCHECK |
| 1211 | # undef strtok_r | ||
| 1212 | # if HAVE_RAW_DECL_STRTOK_R | 1223 | # if HAVE_RAW_DECL_STRTOK_R |
| 1213 | _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " | 1224 | _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " |
| 1214 | "use gnulib module strtok_r for portability"); | 1225 | "use gnulib module strtok_r for portability"); |
| @@ -1241,7 +1252,7 @@ _GL_EXTERN_C bool str_endswith (const char *string, const char *prefix) | |||
| 1241 | # ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ | 1252 | # ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ |
| 1242 | # undef mbslen | 1253 | # undef mbslen |
| 1243 | # endif | 1254 | # endif |
| 1244 | # if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ | 1255 | # if @HAVE_MBSLEN@ /* AIX, MirBSD define mbslen already in libc. */ |
| 1245 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1256 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 1246 | # define mbslen rpl_mbslen | 1257 | # define mbslen rpl_mbslen |
| 1247 | # endif | 1258 | # endif |
| @@ -1546,8 +1557,6 @@ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim, | |||
| 1546 | _GL_EXTERN_C bool mbs_startswith (const char *string, const char *prefix) | 1557 | _GL_EXTERN_C bool mbs_startswith (const char *string, const char *prefix) |
| 1547 | _GL_ATTRIBUTE_PURE | 1558 | _GL_ATTRIBUTE_PURE |
| 1548 | _GL_ARG_NONNULL ((1, 2)); | 1559 | _GL_ARG_NONNULL ((1, 2)); |
| 1549 | /* No extra code is needed for multibyte locales for this function. */ | ||
| 1550 | # define mbs_startswith str_startswith | ||
| 1551 | #endif | 1560 | #endif |
| 1552 | 1561 | ||
| 1553 | #if @GNULIB_MBS_ENDSWITH@ | 1562 | #if @GNULIB_MBS_ENDSWITH@ |
| @@ -1576,7 +1585,6 @@ _GL_CXXALIAS_SYS (strerror, char *, (int)); | |||
| 1576 | _GL_CXXALIASWARN (strerror); | 1585 | _GL_CXXALIASWARN (strerror); |
| 1577 | # endif | 1586 | # endif |
| 1578 | #elif defined GNULIB_POSIXCHECK | 1587 | #elif defined GNULIB_POSIXCHECK |
| 1579 | # undef strerror | ||
| 1580 | /* Assume strerror is always declared. */ | 1588 | /* Assume strerror is always declared. */ |
| 1581 | _GL_WARN_ON_USE (strerror, "strerror is unportable - " | 1589 | _GL_WARN_ON_USE (strerror, "strerror is unportable - " |
| 1582 | "use gnulib module strerror to guarantee non-NULL result"); | 1590 | "use gnulib module strerror to guarantee non-NULL result"); |
| @@ -1604,7 +1612,6 @@ _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); | |||
| 1604 | _GL_CXXALIASWARN (strerror_r); | 1612 | _GL_CXXALIASWARN (strerror_r); |
| 1605 | # endif | 1613 | # endif |
| 1606 | #elif defined GNULIB_POSIXCHECK | 1614 | #elif defined GNULIB_POSIXCHECK |
| 1607 | # undef strerror_r | ||
| 1608 | # if HAVE_RAW_DECL_STRERROR_R | 1615 | # if HAVE_RAW_DECL_STRERROR_R |
| 1609 | _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " | 1616 | _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " |
| 1610 | "use gnulib module strerror_r-posix for portability"); | 1617 | "use gnulib module strerror_r-posix for portability"); |
| @@ -1633,7 +1640,6 @@ _GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale)); | |||
| 1633 | _GL_CXXALIASWARN (strerror_l); | 1640 | _GL_CXXALIASWARN (strerror_l); |
| 1634 | # endif | 1641 | # endif |
| 1635 | #elif defined GNULIB_POSIXCHECK | 1642 | #elif defined GNULIB_POSIXCHECK |
| 1636 | # undef strerror_l | ||
| 1637 | # if HAVE_RAW_DECL_STRERROR_L | 1643 | # if HAVE_RAW_DECL_STRERROR_L |
| 1638 | _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - " | 1644 | _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - " |
| 1639 | "use gnulib module strerror_l for portability"); | 1645 | "use gnulib module strerror_l for portability"); |
| @@ -1668,7 +1674,6 @@ _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); | |||
| 1668 | _GL_CXXALIASWARN (strerrorname_np); | 1674 | _GL_CXXALIASWARN (strerrorname_np); |
| 1669 | # endif | 1675 | # endif |
| 1670 | #elif defined GNULIB_POSIXCHECK | 1676 | #elif defined GNULIB_POSIXCHECK |
| 1671 | # undef strerrorname_np | ||
| 1672 | # if HAVE_RAW_DECL_STRERRORNAME_NP | 1677 | # if HAVE_RAW_DECL_STRERRORNAME_NP |
| 1673 | _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - " | 1678 | _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - " |
| 1674 | "use gnulib module strerrorname_np for portability"); | 1679 | "use gnulib module strerrorname_np for portability"); |
| @@ -1683,7 +1688,6 @@ _GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig), ); | |||
| 1683 | _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); | 1688 | _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); |
| 1684 | _GL_CXXALIASWARN (sigabbrev_np); | 1689 | _GL_CXXALIASWARN (sigabbrev_np); |
| 1685 | #elif defined GNULIB_POSIXCHECK | 1690 | #elif defined GNULIB_POSIXCHECK |
| 1686 | # undef sigabbrev_np | ||
| 1687 | # if HAVE_RAW_DECL_SIGABBREV_NP | 1691 | # if HAVE_RAW_DECL_SIGABBREV_NP |
| 1688 | _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " | 1692 | _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " |
| 1689 | "use gnulib module sigabbrev_np for portability"); | 1693 | "use gnulib module sigabbrev_np for portability"); |
| @@ -1698,7 +1702,6 @@ _GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig), ); | |||
| 1698 | _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); | 1702 | _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); |
| 1699 | _GL_CXXALIASWARN (sigdescr_np); | 1703 | _GL_CXXALIASWARN (sigdescr_np); |
| 1700 | #elif defined GNULIB_POSIXCHECK | 1704 | #elif defined GNULIB_POSIXCHECK |
| 1701 | # undef sigdescr_np | ||
| 1702 | # if HAVE_RAW_DECL_SIGDESCR_NP | 1705 | # if HAVE_RAW_DECL_SIGDESCR_NP |
| 1703 | _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - " | 1706 | _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - " |
| 1704 | "use gnulib module sigdescr_np for portability"); | 1707 | "use gnulib module sigdescr_np for portability"); |
| @@ -1722,7 +1725,6 @@ _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); | |||
| 1722 | # endif | 1725 | # endif |
| 1723 | _GL_CXXALIASWARN (strsignal); | 1726 | _GL_CXXALIASWARN (strsignal); |
| 1724 | #elif defined GNULIB_POSIXCHECK | 1727 | #elif defined GNULIB_POSIXCHECK |
| 1725 | # undef strsignal | ||
| 1726 | # if HAVE_RAW_DECL_STRSIGNAL | 1728 | # if HAVE_RAW_DECL_STRSIGNAL |
| 1727 | _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " | 1729 | _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " |
| 1728 | "use gnulib module strsignal for portability"); | 1730 | "use gnulib module strsignal for portability"); |
| @@ -1748,13 +1750,13 @@ _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); | |||
| 1748 | # endif | 1750 | # endif |
| 1749 | _GL_CXXALIASWARN (strverscmp); | 1751 | _GL_CXXALIASWARN (strverscmp); |
| 1750 | #elif defined GNULIB_POSIXCHECK | 1752 | #elif defined GNULIB_POSIXCHECK |
| 1751 | # undef strverscmp | ||
| 1752 | # if HAVE_RAW_DECL_STRVERSCMP | 1753 | # if HAVE_RAW_DECL_STRVERSCMP |
| 1753 | _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " | 1754 | _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " |
| 1754 | "use gnulib module strverscmp for portability"); | 1755 | "use gnulib module strverscmp for portability"); |
| 1755 | # endif | 1756 | # endif |
| 1756 | #endif | 1757 | #endif |
| 1757 | 1758 | ||
| 1759 | _GL_INLINE_HEADER_END | ||
| 1758 | 1760 | ||
| 1759 | #endif /* _@GUARD_PREFIX@_STRING_H */ | 1761 | #endif /* _@GUARD_PREFIX@_STRING_H */ |
| 1760 | #endif /* _@GUARD_PREFIX@_STRING_H */ | 1762 | #endif /* _@GUARD_PREFIX@_STRING_H */ |
