diffutils-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: From wchar_t to char32_t


From: Paul Eggert
Subject: Re: From wchar_t to char32_t
Date: Tue, 11 Jul 2023 07:41:14 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 2023-07-11 01:24, Bruno Haible wrote:
Based on the comments in gnulib/lib/mbrtoc16.c, I think it should better
clear the first 24, not 12, bytes of the struct. Otherwise it can be in
a state where mbsinit() returns true but the mbrto* functions have
undefined behaviour.

For mbcel all all that matters is mbrtoc32. Could you give an example of the undefined behavior there? I looked at the citrus implementations in current FreeBSD, OpenBSD and macOS and thought that 12 bytes is enough for mbrtoc32 on all their porting targets. NetBSD is a bit different and needs just a pointer width.

I didn't look at other functions like mbrlen and mbsinit, but would be mildly surprised if these functions differed, as mbrtoc32 is the fundamental function.

Assuming the optimization is valid, I suppose we could put it in Gnulib. Though it doesn't help much on GNU/Linux and so is lower priority.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]