Yes, this is exactly what I was worrying about. At least it affects only ancient CRTs.
- Kirill Makurin ________________________________ From: Pali Rohár <[email protected]> Sent: Wednesday, December 31, 2025 8:24 PM To: Kirill Makurin <[email protected]> Cc: [email protected] <[email protected]> Subject: Re: [Mingw-w64-public] [PATCH 0/3] Improve mingw _cp helper functions That caching would not work if application uses DLL library which also call setlocate. Caches between EXE application and DLL library would not be shared and we have a new problem how to properly invalidate the cache. So I would rather avoid those caches and always use up-to-date value from ___lc_codepage_func even it is slow. On Wednesday 31 December 2025 08:19:57 Kirill Makurin wrote: > I was wondering whether we could cache value returned by > `___lc_codepage_func` for crtdll.dll instead of parsing return from > `setlocale` every time. I was thinking maybe a wrapper around `setlocale` > which would parse it once after successful call? But I have a feeling this > would not work in all cases. > > - Kirill Makurin > ________________________________ > From: Pali Rohár <[email protected]> > Sent: Wednesday, December 31, 2025 4:27 AM > To: Kirill Makurin <[email protected]> > Cc: [email protected] > <[email protected]> > Subject: Re: [Mingw-w64-public] [PATCH 0/3] Improve mingw _cp helper functions > > Hm... right, it makes sense to use __mingw_isleadbyte_cp() also in > __mingw_mbrtowc_cp() as it gets the "cp" argument from the parent > function. > > On Tuesday 30 December 2025 19:16:35 Kirill Makurin wrote: > > From: Kirill Makurin <[email protected]> > > Sent: Wednesday, December 31, 2025 4:09 AM > > To: [email protected] > > <[email protected]> > > Subject: Re: [Mingw-w64-public] [PATCH 0/3] Improve mingw _cp helper > > functions > > > > Hi Pali, this patch series looks good to me. > > > > I suggest we use new __mingw_isleadbyte_cp in __mingw_mbrtowc_cp which > > currently uses isleadbyte. I think when I was looking through Microsoft > > header files, I noted that isleadbyte was guarded with WINAPI_FAMILY > > checks, so it may not be available to all types of apps (could you please > > check it if it is not too much trouble?). > > > > - Kirill Makurin > > ________________________________ > > From: Pali Rohár <[email protected]> > > Sent: Wednesday, December 31, 2025 3:29 AM > > To: [email protected] > > <[email protected]> > > Subject: [Mingw-w64-public] [PATCH 0/3] Improve mingw _cp helper functions > > > > Changes were applied on top of the 8d02d610f707b5f6af74653c6ebb0cdfa4df9212 > > > > Pali Rohár (3): > > crt: Improve __mingw_filename_cp() to work on systems without > > AreFileApisANSI() function > > crt: Add helper function __mingw_isleadbyte_cp() > > crt: Replace IsDBCSLeadByteEx() usage by __mingw_isleadbyte_cp() > > > > mingw-w64-crt/Makefile.am | 1 + > > mingw-w64-crt/misc/__mingw_filename_cp.c | 17 ++++++++-- > > mingw-w64-crt/misc/__mingw_isleadbyte_cp.c | 36 +++++++++++++++++++++ > > mingw-w64-crt/misc/dirname.c | 4 +-- > > mingw-w64-crt/stdio/__mingw_fix_stat_path.c | 2 +- > > mingw-w64-crt/testcases/t_btowc.c | 2 +- > > mingw-w64-headers/crt/locale.h | 3 ++ > > 7 files changed, 58 insertions(+), 7 deletions(-) > > create mode 100644 mingw-w64-crt/misc/__mingw_isleadbyte_cp.c > > > > -- > > 2.20.1 > > > > > > > > _______________________________________________ > > Mingw-w64-public mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
