Hello, have you looked at these and follow-up "crt: add internal function 
__mingw_wcrtomb_cp"?

- Kirill Makurin
________________________________
From: Kirill Makurin <[email protected]>
Sent: Saturday, October 4, 2025 10:40 PM
To: Pali Rohár <[email protected]>
Cc: mingw-w64-public <[email protected]>
Subject: Re: [Mingw-w64-public] crt: add internal function __mingw_mbrtowc_cp

Ok, this sounds good to me, __mingw_mbrtowc_cp should not really be visible to 
users.

These are the same patches except they declare __mingw_mbrtowc_cp in new 
internal mingw-wchar.h.

Maybe it would be good to check for places where we call either of mbrlen, 
mbrtowc ot wcrtomb repeatedly and replace them with internal versions?

- Kirill Makurin
________________________________
From: Pali Rohár <[email protected]>
Sent: Saturday, October 4, 2025 9:56 PM
To: Kirill Makurin <[email protected]>
Cc: mingw-w64-public <[email protected]>
Subject: Re: crt: add internal function __mingw_mbrtowc_cp

Hello, thanks for looking at this. For me it looks good. Just one note.

I would propose to not export that __mingw_mbrtowc_cp function from
public mingw-w64-headers headers at least for now, and rather have it in
some private mingw-w64-crt header only for mingw-w64 CRT code.

As we are still improving the mb* functions it is quite better to not
make that function visible for regular application until the API is
stable, which can prevent API breakage in case we would need to modify
this code again.

On Saturday 04 October 2025 12:47:33 Kirill Makurin wrote:
> This internal function is used to implement C95 functions mbrlen, mbrtowc and 
> mbsrtowcs. This makes difference for crtdll.dll, where `___lc_codepage_func` 
> parses return value of setlocale(LC_ALL, NULL) and converts code page part to 
> an `int`. With this change `mbsrtowcs` only needs to call both 
> `___lc_codepage_func` and `___mb_cur_max_func` once.
>
> I wasn't sure where to declare __mingw_mbrtowc_cp; I don't feel like creating 
> internal header file just for one function, so I declared it in wchar.h.
>
> If we're good with these patches, I'll send similar patches for `wcrtomb` and 
> `wcsrtombs`.
>
> I just pushed them to my GitHub fork to run CI tests[1].
>
> - Kirill Makurin
>
> [1] https://github.com/maiddaisuki/mingw-w64/actions/runs/18244326038

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to