From: Bruno Haible Date: Tue, 11 Jul 2023 22:58:51 +0000 (+0200) Subject: mbsrtoc32s, mbsnrtoc32s: Small optimization. X-Git-Tag: v1.0~1128 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=898cd2dc647b75f472d69bb1d2d116719725c31c;p=gnulib.git 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/ChangeLog b/ChangeLog index 22000a4549..e55bfec8ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-07-11 Bruno Haible + + 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 mbswidth: Add a benchmark. 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