Re: How best to reinstate fast mbrtowc and mbrtoc32 (for coreutils)?
From:
Bruno Haible
Subject:
Re: How best to reinstate fast mbrtowc and mbrtoc32 (for coreutils)?
Date:
Fri, 27 Mar 2026 19:23:54 +0100
Pádraig Brady wrote:
> In the attached I adjusted things so that the efficient
> dispatch routines are used once the wchar-single module is referenced.
> I'm not sure about this approach
The patch has two main problems:
* In the case of a UTF-8 locale, the mbstate_t from the gnulib code
(meant for being used if GNULIB_defined_mbstate_t) disagrees with
the mbstate_t from glibc, leading to unit test failures in
coreutils/gnulib-tests:
FAIL: test-mbrlen-3.sh
FAIL: test-mbrtowc-3.sh
FAIL: test-mbsrtoc32s-3.sh
FAIL: test-mbsrtowcs-3.sh
* In the other case, it uses a fallback via mbtowc(), which needs locking
in order to be multithread-safe. This is meant for AIX only. On glibc,
it is better to use the current fallback code.
But both problems are fixable. I am working on that...
Bruno