]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
mbrtoc32, mbrtowc: do not optimze for uClibc-ng
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 25 May 2026 18:37:32 +0000 (20:37 +0200)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 25 May 2026 21:50:09 +0000 (14:50 -0700)
Problem reported by Waldemar Brodkorb in:
https://lists.gnu.org/r/bug-gnulib/2026-05/msg00145.html
* lib/mbrtoc32.c (mbrtoc32):
* lib/mbrtowc.c (rpl_mbrtowc):
Treat uClibc-ng as non-glibc.

ChangeLog
lib/mbrtoc32.c
lib/mbrtowc.c

index ec8648260eb099178969658f5057c7a90b5116f7..7c1b291c757f16ce825836338e930fb6a02ce7ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-05-25  Waldemar Brodkorb  <wbx@openadk.org>
+
+       mbrtoc32: do not optimze for uClibc-ng
+       * lib/mbrtoc32.c (mbrtoc32):
+       * lib/mbrtowc.c (rpl_mbrtowc):
+       Treat uClibc-ng as non-glibc.
+
 2026-05-25  Paul Eggert  <eggert@cs.ucla.edu>
 
        quotearg: support USE_C_LOCALE variant
index 7d691b8b2ff8fa94ce1949410efe96b425b13324..5f89e05460f6962d399e3dfd868cfe772845d14d 100644 (file)
@@ -97,7 +97,7 @@ mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps)
 #  include <locale.h>
 # endif
 
-# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2)
+# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2 && !__UCLIBC__)
 
 /* Returns 1 if the current locale is an UTF-8 locale, 0 otherwise.  */
 static inline int
@@ -134,7 +134,8 @@ mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps)
       n = 1;
     }
 
-# if MBRTOC32_EMPTY_INPUT_BUG || _GL_SMALL_WCHAR_T || (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2)
+# if (MBRTOC32_EMPTY_INPUT_BUG || _GL_SMALL_WCHAR_T \
+      || (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2 && !__UCLIBC__))
   if (n == 0)
     return (size_t) -2;
 # endif
@@ -142,7 +143,7 @@ mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps)
   if (ps == NULL)
     ps = &internal_state;
 
-# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2)
+# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2 && !__UCLIBC__)
   /* Optimize the frequent case of an UTF-8 locale.
      Since here we are in the !GNULIB_defined_mbstate_t case, i.e. we use
      the system's mbstate_t type and have to provide interoperability with
index 59320cd51cd55c50635a8586c6255ed4f6dd57b6..f533b554f3b4d5ce0bf3b01440207250d5542ad8 100644 (file)
@@ -83,7 +83,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
 #  include <locale.h>
 # endif
 
-# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2)
+# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2 && !__UCLIBC__)
 
 /* Returns 1 if the current locale is an UTF-8 locale, 0 otherwise.  */
 static inline int
@@ -119,12 +119,13 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
     }
 # endif
 
-# if MBRTOWC_EMPTY_INPUT_BUG || (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2)
+# if (MBRTOC32_EMPTY_INPUT_BUG || _GL_SMALL_WCHAR_T \
+      || (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2 && !__UCLIBC__))
   if (n == 0)
     return (size_t) -2;
 # endif
 
-# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2)
+# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2 && !__UCLIBC__)
   /* Optimize the frequent case of an UTF-8 locale.
      Since here we are in the !GNULIB_defined_mbstate_t case, i.e. we use
      the system's mbstate_t type and have to provide interoperability with