]> Savannah Git Hosting - gnulib.git/commitdiff
mbsrtoc32s, mbsnrtoc32s: Small optimization.
authorBruno Haible <bruno@clisp.org>
Tue, 11 Jul 2023 22:58:51 +0000 (00:58 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 11 Jul 2023 22:58:51 +0000 (00:58 +0200)
* lib/mbsrtoc32s.c (USES_C32): Set to 0 when the module
'mbrtoc32-regular' is in use.
* lib/mbsnrtoc32s.c (USES_C32): Likewise.

ChangeLog
lib/mbsnrtoc32s.c
lib/mbsrtoc32s.c

index 22000a454991e4dca37d3ff5fd344a5ce47dfada..e55bfec8ed65028f2624aa298e8e806e9b2c7df2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-07-11  Bruno Haible  <bruno@clisp.org>
+
+       mbsrtoc32s, mbsnrtoc32s: Small optimization.
+       * lib/mbsrtoc32s.c (USES_C32): Set to 0 when the module
+       'mbrtoc32-regular' is in use.
+       * lib/mbsnrtoc32s.c (USES_C32): Likewise.
+
 2023-07-11  Bruno Haible  <bruno@clisp.org>
 
        mbswidth: Add a benchmark.
index 788eadd99ee315769fc0a2840ab0d3b43aeda8de..0377a361d39fe000b509afbfbe08bcc9b4a31133 100644 (file)
@@ -47,7 +47,13 @@ extern mbstate_t _gl_mbsrtoc32s_state;
 # define DCHAR_T char32_t
 # define INTERNAL_STATE _gl_mbsrtoc32s_state
 # define MBRTOWC mbrtoc32
-# define USES_C32 1
+# if GNULIB_MBRTOC32_REGULAR
+   /* If the 'mbrtoc32-regular' module is in use, we don't need to handle
+      a (size_t)(-3) return value from mbrtoc32.  */
+#  define USES_C32 0
+# else
+#  define USES_C32 1
+# endif
 # include "mbsnrtowcs-impl.h"
 
 #else
index 92f7433818d8e51a696d5c8460dd5cf1f7f76f03..19ec126b5f58bdc5acecef5a3f83a35fb8dc71e2 100644 (file)
@@ -39,7 +39,13 @@ extern mbstate_t _gl_mbsrtoc32s_state;
 # define DCHAR_T char32_t
 # define INTERNAL_STATE _gl_mbsrtoc32s_state
 # define MBRTOWC mbrtoc32
-# define USES_C32 1
+# if GNULIB_MBRTOC32_REGULAR
+   /* If the 'mbrtoc32-regular' module is in use, we don't need to handle
+      a (size_t)(-3) return value from mbrtoc32.  */
+#  define USES_C32 0
+# else
+#  define USES_C32 1
+# endif
 # include "mbsrtowcs-impl.h"
 
 #else