Another small optimization of the same kind:
2023-07-11 Bruno Haible <[email protected]> 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. diff --git a/lib/mbsnrtoc32s.c b/lib/mbsnrtoc32s.c index 788eadd99e..0377a361d3 100644 --- a/lib/mbsnrtoc32s.c +++ b/lib/mbsnrtoc32s.c @@ -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 diff --git a/lib/mbsrtoc32s.c b/lib/mbsrtoc32s.c index 92f7433818..19ec126b5f 100644 --- a/lib/mbsrtoc32s.c +++ b/lib/mbsrtoc32s.c @@ -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
