Branch: refs/heads/smoke-me/khw-locale Home: https://github.com/Perl/perl5 Commit: 7311996f0aecc9802e9b55adf845c3918a6dce53 https://github.com/Perl/perl5/commit/7311996f0aecc9802e9b55adf845c3918a6dce53 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021)
Changed paths: M perl.h Log Message: ----------- Add ability to easily add info to DEBUG output This commit adds two macros that a user can define and recompile Perl to get every active DEBUG statement to do something beyond what it would normally do. This allows someone to recompile Perl when they need to delve deeper into fixing a bug without increasing memory use or slowing execution otherwise. Commit: 6cdd96c20479f5842f776e47205b9f26af1eb29c https://github.com/Perl/perl5/commit/6cdd96c20479f5842f776e47205b9f26af1eb29c Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M mg.c Log Message: ----------- XXX better message: mg.c: Silence compiler warning Commit: 80b11803549cf0b372d16d4c75b65d2cefa8ed5e https://github.com/Perl/perl5/commit/80b11803549cf0b372d16d4c75b65d2cefa8ed5e Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M lib/locale_threads.t Log Message: ----------- XXX locale_threads Commit: ec822bfb0aa59a2f4f7edc8f2ab7602789b8e1ff https://github.com/Perl/perl5/commit/ec822bfb0aa59a2f4f7edc8f2ab7602789b8e1ff Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c M perl.h Log Message: ----------- DEBUG_L now also looks at environment variable Because locale initialization happens before command line processing, one can't pass a -DL argument to enable debugging of locale initialization. Instead, an environment variable is read then, and is used to enable debugging or not. In the past, code specifically had to test for this being set. This commit changes that so that debugging can automatically be enabled without having to write special code. Future commits will strip out those special checks. Commit: 8aa6ff6ef8ee18114e7b7764716d9aef9060b0dd https://github.com/Perl/perl5/commit/8aa6ff6ef8ee18114e7b7764716d9aef9060b0dd Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Replace most #ifdef DEBUGGING lines THe previous commit enhanced the DEBUG macros so that they contain the logic that previously had to be done with conditional compilation statements. Removing them makes the code easier to read. Commit: 0217aff26baf69c03d817e51bc57934893951b5e https://github.com/Perl/perl5/commit/0217aff26baf69c03d817e51bc57934893951b5e Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M handy.h M numeric.c M regcomp.c M regexec.c M utfebcdic.h Log Message: ----------- Change macro names to be C standard conformant C reserves symbols beginning with underscores for its own use. This commit moves the underscore so it is trailing, which is legal. The symbols changed here are most of the ones in handy.h that have few uses outside it. Commit: fd43a12f25e376353b8f95783aeadbd5a80ab4ed https://github.com/Perl/perl5/commit/fd43a12f25e376353b8f95783aeadbd5a80ab4ed Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M handy.h Log Message: ----------- handy.h: Refactor some #ifdef's for commonality This changes these compilation conditionals so that things in common between Windows and other platforms are only defined once. It changes the isWORDCHAR_LC definition for non-Windows to match that platform, adding an UNLIKELY(). Commit: afd86708c02758d19a4c5f58dc20f516d2516d29 https://github.com/Perl/perl5/commit/afd86708c02758d19a4c5f58dc20f516d2516d29 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M handy.h Log Message: ----------- handy.h: White-space, comment only Commit: 40e8e7b649dd00677551230567b7fb638b73b742 https://github.com/Perl/perl5/commit/40e8e7b649dd00677551230567b7fb638b73b742 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M handy.h Log Message: ----------- handy.h: Remove only call to an internal macro Replace isIDFIRST_LC with a slightly faster implementation, in line with what isWORDCHAR already does Commit: af0180c66164b0aa7d5519a4ded77793e66e52fe https://github.com/Perl/perl5/commit/af0180c66164b0aa7d5519a4ded77793e66e52fe Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M charclass_invlists.h M handy.h M l1_char_class_tab.h M lib/unicore/uni_keywords.pl M perl.c M perl.h M regcomp.c M regcomp.h M regen/mk_PL_charclass.pl M regexec.c M sv.c M uni_keywords.h M utfebcdic.h Log Message: ----------- Change macro names to be C standard conformant C reserves symbols beginning with underscores for its own use. This commit moves the underscore so it is trailing, which is legal. The symbols changed here are many of the ones in handy.h that have significant uses outside it. Commit: 941e6124ae8f32dff8bc68dedfd123fd0b162ad5 https://github.com/Perl/perl5/commit/941e6124ae8f32dff8bc68dedfd123fd0b162ad5 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M handy.h Log Message: ----------- handy.h: Rmv unneeded generality The possible first character of an ID is always an alpha in the range 0-255, so there is no harm changing from the former to the latter. And future changes would otherwise have needed an extra parameter in a bunch of macros. Commit: e933961addb5955cd9acb7c6a3d801402370005a https://github.com/Perl/perl5/commit/e933961addb5955cd9acb7c6a3d801402370005a Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M handy.h Log Message: ----------- handy.h: Don't special case isASCII_LC This was an attempt to save instructions, but future commits will need the generality Commit: 9d106ad91134e8461b548be0afd4f7c846c4f8a3 https://github.com/Perl/perl5/commit/9d106ad91134e8461b548be0afd4f7c846c4f8a3 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M handy.h Log Message: ----------- handy.h: Refactor some internal macros This changes the parameters etc, in preparation for further changes Commit: d7b49887d3e54258b703551295e4e935775e084d https://github.com/Perl/perl5/commit/d7b49887d3e54258b703551295e4e935775e084d Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M globvar.sym M handy.h M inline.h M perl.h M proto.h M regexec.c Log Message: ----------- regexec.c: Use function call table to streamline code This replaces a switch() statement with a function pointer table. But the main reason I'm doing this is for future functionality. Commit: 91afa6e501b511ba8550b53f79dfc12845f19529 https://github.com/Perl/perl5/commit/91afa6e501b511ba8550b53f79dfc12845f19529 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Declare three static arrays to be so. Commit: d6508bf7fe6e91d205b7f1b3f49426f39ecae443 https://github.com/Perl/perl5/commit/d6508bf7fe6e91d205b7f1b3f49426f39ecae443 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c M perl.h Log Message: ----------- Move some locale.c #defines to perl.h This is in preparation for them to be used in macros from outside locale.c Commit: f2e0a972519da30e4333a90aaa9e8720c0a924b7 https://github.com/Perl/perl5/commit/f2e0a972519da30e4333a90aaa9e8720c0a924b7 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c M perl.h Log Message: ----------- Mark newly moved symbols as private The previous commit made certain symbols that previously were local to locale.c now available everywhere. Add a trailing underscore to their names to mark them as private. Commit: 97cb1ea1e2b85bff8e8adb431cc119ab92fadebf https://github.com/Perl/perl5/commit/97cb1ea1e2b85bff8e8adb431cc119ab92fadebf Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c M makedef.pl M perl.h Log Message: ----------- Add USE_LOCALE_THREADS #define This is in preparation for supporting configurations where there threads are available, but the locale handling code should ignore that fact. This stems from the unusual locale handling of z/OS, where any attempt is ignored to change locales after the first thread is created. Commit: e9b97ff50e8685f2772d653865d8915c17626b7b https://github.com/Perl/perl5/commit/e9b97ff50e8685f2772d653865d8915c17626b7b Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M ext/POSIX/POSIX.xs M ext/POSIX/lib/POSIX.pm M intrpvar.h M locale.c M makedef.pl M perl.c M perl.h M sv.c Log Message: ----------- Regularize HAS_POSIX_2008_LOCALE, USE_POSIX_2008_LOCALE A platform shouldn't be required to use the Posix 2008 locale handling functions if they are present. Perhaps they are buggy. So, a separate define for using them was introduced, USE_POSIX_2008_LOCALE. But until this commit there were cases that were looking at the underlying availability of the functions, not if the Configuration called for their use. Commit: b6835a23e7aaa83984e63478550ebc144b40dd67 https://github.com/Perl/perl5/commit/b6835a23e7aaa83984e63478550ebc144b40dd67 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Change macro name Adopt the git convention of 'porcelain' meaning without special handling. This makes it clear that porcelain_setlocale macro is the base level. Commit: d15e36ffa850674567d63a68d6ba79e961b8e13b https://github.com/Perl/perl5/commit/d15e36ffa850674567d63a68d6ba79e961b8e13b Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Cast return of setlocale() to const If they had it to do over again, the libc makers would have made the return of this function 'const char *'. We can cast it that way internally to catch erroneous uses at compile time. Commit: 88f88b545367ec5ffdd28a9668bdf67204496b6a https://github.com/Perl/perl5/commit/88f88b545367ec5ffdd28a9668bdf67204496b6a Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Create S_get_category_index() libc locale categories, like LC_NUMERIC, are opaque integers. This makes it inconvenient to have table-driven code. Instead, we have tables that are indexed by small positive integers, which are a compile-time mapping from the libc values. This commit creates a run-time function to also do that mapping. It will first be used in the next commit. The function does a loop through the available categories, looking for a match. It could be replaced by some sort of quick hash lookup, but the largest arrays in the field have a max of 12 elements, with almost all searches finding their quarry in the first 6. It doesn't seem worthwhile to me to replace a linear search of 6 elements by something more complicated. The design intent is this search will be used only at the edgest of the locale-handling code; once found the index is used in future bits of the current operation. Commit: 056876c252cc1de39f98ddd9d622b7bf9d9ff535 https://github.com/Perl/perl5/commit/056876c252cc1de39f98ddd9d622b7bf9d9ff535 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Use get_category_index() This creates the first uses of the function added in the previous commit. It changes the name of a function that now takes an index to have the suffix _i to indicate its calling parameter is a category index rather than a category. This will become a common paradigm in this file in later commits. Two macros are also created to call that function; they have suffixes _c (to indicate the parameter is a category known at compile time, and _r (to indicate it needs to be computed at runtime). This is in keeping with the already existing paradigm in this file. Commit: c01b60bb608c0e7b43e6673b3be0d1e3ef786ffa https://github.com/Perl/perl5/commit/c01b60bb608c0e7b43e6673b3be0d1e3ef786ffa Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Change S_emulate_setlocale name and sig It turns out this function is called only from places where we have the category index already computed; so change the signature to use the index and remove the re-calculation. It renames it to emulate_setlocale_i() to indicate that the category parameter is an index. This also means, that it's very unlikely that it will be called with an out-of-bounds value. Remove the debugging statement for that case (but retain the error return value). Commit: 99d65edf27d730e8209e17eeb91c35deeecd90e0 https://github.com/Perl/perl5/commit/99d65edf27d730e8209e17eeb91c35deeecd90e0 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Use nocontext; avoid rarely needed dTHX This is a rare case; no point in doing a dTHX just for it. Commit: 5bafe08b7c2d113ccb876f4eae867800f3f16b71 https://github.com/Perl/perl5/commit/5bafe08b7c2d113ccb876f4eae867800f3f16b71 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c M pod/perldelta.pod M pod/perldiag.pod Log Message: ----------- locale.c: Simplify S_category_name We can use the new function S_get_category_index() to simplify this. Also, when I wrote it I didn't know about Perl_form(), and had reimplemented a portion of it here; which is yanked as well. Commit: aec2a331059e1ca7db6f82f6b40181f963cc83fa https://github.com/Perl/perl5/commit/aec2a331059e1ca7db6f82f6b40181f963cc83fa Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Move unreachable code It turns out this code, setting errno, is unreachable. Move it to the place where it would do some good, removing an extraneous, unreachable return; Commit: 6b525b5bdf57f562f3b4e1c4f07cb29f948208c9 https://github.com/Perl/perl5/commit/6b525b5bdf57f562f3b4e1c4f07cb29f948208c9 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Comment clarifications, white space Some of these are to make future difference listings shorter Some of the changes look like incorrect indentation here, but anticipate future commits. Commit: 0a3073d368ee99a68c5ac2a4ddf96e9974a01701 https://github.com/Perl/perl5/commit/0a3073d368ee99a68c5ac2a4ddf96e9974a01701 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Separate query part of emulate_setlocale() This splits a large function so that it is easier to comprehend, and is in preparation for them to be separately callable. Commit: f5d3548eb79783224f55866156bf2f5d35d62168 https://github.com/Perl/perl5/commit/f5d3548eb79783224f55866156bf2f5d35d62168 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Remove spaces around a '##' preprocessor directive It turns out that at least my gcc preprocessor gets confused in some contexts if spaces surround the ##. CAT2() doesn't work for these. It is working in this context, but future commits will introduce ones where it won't, so this commit will help make things consistent within this file What seems to fail is #define f(x) (..., g(x ## y), ...) where 'x' is a an already #defined symbol. I want 'xy', but instead, for example if 'x' has been defined to be 1, I get '1y' Commit: eb2045b5f12d214149b68ed82002d99cc6ec84ba https://github.com/Perl/perl5/commit/eb2045b5f12d214149b68ed82002d99cc6ec84ba Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: #define some macros in terms of a base one This is so changes to the lowest level automatically propagate to the others Commit: 4357669e2db66b720121df33203827ff3f3b0fd2 https://github.com/Perl/perl5/commit/4357669e2db66b720121df33203827ff3f3b0fd2 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Create new macros for just querying locale There are two sets of names, which immediately indicate if the result can be relied on to be thread level or must be assumed to be global to the whole process. At the moment they all expand to the same thing, since on a threadless perl, it's a don't care; and on a threaded perl, they are all already thread-level, in the Configurations we support. Future commits will cause the macros to diverge, and comments will be added then. For POSIX 2008, this commit causes queries to go directly to the query function, avoiding S_emulate_setlocale_i() completely. Commit: eab65affb41ef4eda439ef2584b6d22733ea2b6d https://github.com/Perl/perl5/commit/eab65affb41ef4eda439ef2584b6d22733ea2b6d Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Generalize certain Win32 calls The old versions were windows-specific; the changes use a more generic macro that currently expands to the same thing, but future commits will change that. Commit: 681feb3ef048284ac993741696edd4a292e35b57 https://github.com/Perl/perl5/commit/681feb3ef048284ac993741696edd4a292e35b57 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Add a convenience #define This makes it clear if we are using an array that currently only happens on non-querylocale systems, but that will change in future commits. Commit: dc9c1054ce4221ef645af6b4ab874b5845a638a2 https://github.com/Perl/perl5/commit/dc9c1054ce4221ef645af6b4ab874b5845a638a2 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Add setlocale() return context macros Future commits will benefit from knowing if the return value of setlocale is to be ignored, just checked for if it worked, or the full value is needed and can be relied on (or not) to be per-thread. Commit: eafe3252a3656c5175f026c0890144a4efe1b658 https://github.com/Perl/perl5/commit/eafe3252a3656c5175f026c0890144a4efe1b658 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Add panic check/message This panic is done when a setlocale unexpectedly fails. Commit: 3d8909fa62f776ad3d8a11ed54df3738997e53f9 https://github.com/Perl/perl5/commit/3d8909fa62f776ad3d8a11ed54df3738997e53f9 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Use a function table to simplify code Some locale categories require extra steps when they are changed. This moves that logic to a table, which gets rid of some code Commit: 9eb148d628717156eb684e32626fd3218d6fc903 https://github.com/Perl/perl5/commit/9eb148d628717156eb684e32626fd3218d6fc903 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- Perl_setlocale(): Same code for all param2 == NULL Calling Perl_setlocale() with a NULL 2nd parameter returns the current locale, rather than changing it. Previously LC_NUMERIC and LC_ALL were treated specially; other categories were lumped in with the code that changes the locale. Changing some categories involves a non-trivial amount of work. This commit avoids that by moving all queries to the same 'if' branch. LC_NUMERIC and LC_ALL still have to be treated specially, but now it's all within the same outer 'if', and the unnecessarily executing code for when the locale changes is avoided. Commit: f59347ee850e176def1bd3129df4b833862e89cf https://github.com/Perl/perl5/commit/f59347ee850e176def1bd3129df4b833862e89cf Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Use low level macros at low level Implementing Perl_setlocale, we can safely use the internal macros that the public ones expand to call, without the overhead those public macros impose (which they do to be more immune from improper calls from outside code). Commit: 612556dbafd8c39840ef0163643717ead505bebc https://github.com/Perl/perl5/commit/612556dbafd8c39840ef0163643717ead505bebc Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Remove exploratory code This code was to find out, in debugging builds, if an undocumented glibc feature worked. There were no reports that it didn't, and so, after, several releases, it has served its purpose. A future commit will allow enabling this feature as a Configuration option. Commit: 0d7b12cbf1644fbfab258a2ae48a52fc06bb7a68 https://github.com/Perl/perl5/commit/0d7b12cbf1644fbfab258a2ae48a52fc06bb7a68 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M intrpvar.h M locale.c M proto.h Log Message: ----------- locale.c: querylocale() doesn't work on LC_ALL I had misread the man pages. This bug has been in the field for several releases now, but most likely hasn't shown up because it's almost always the case that the locale categories will be set to the same locale. And so most implementations of querylocale() would return the correct result. This commit works by splitting the calculation of the value of LC_ALL from S_emulate_setlocale_i() into a separate function, and extending it to work on querylocale() systems. This has the added benefit of removing tangential code from the main line, making S_emulate_setlocale_i easier to read. calculate_LC_ALL() is the new function, and is now called from two places. Part of this change is to keep our records of LC_ALL on non-querylocale systems always up-to-date, which is better practice And part of this change is temporary, marked as such, to be removed a few commits later. Commit: dc443985f8c21aac6074e817065b1c15e2ebbfcc https://github.com/Perl/perl5/commit/dc443985f8c21aac6074e817065b1c15e2ebbfcc Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Use setlocale() for init, not P2008 We have found bugs in the POSIX 2008 libc implementations on various platforms. This code, which does the initialization of locale handling has always been very conservative, expecting possible failures due to bugs in it our the libc implementations, and backing out if necessary to a crippled, but workable state, if something goes wrong. I think we should use the oldest, most stable locale implementation in these circumstances Commit: 4f46ce3430ded7e319a8a58cd9483fe65bed7438 https://github.com/Perl/perl5/commit/4f46ce3430ded7e319a8a58cd9483fe65bed7438 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c M perl.h Log Message: ----------- Allow use of glibc undocumented locale fcn glibc does not furnish querylocale() that Darwin and *BSD systems do. But glibc does provide a long-standing, undocumented querylocale equivalent. Perl provides a workaround for systems without querylocale(), but this commit causes -Accflags=-DUSE_NL_LOCALE_NAME when passed to Configure to use the undocumented function instead of the workaround. For now, I am not otherwise documenting this ability, since the underlying function isn't documented. Commit: 1628c60fd3d2b66dada9b46d422df0b7725a5fa8 https://github.com/Perl/perl5/commit/1628c60fd3d2b66dada9b46d422df0b7725a5fa8 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Split aggregate LC_ALL from emulate_setlocale This splits into a separate function the code necessary in some Configurations to calculate LC_ALL from a potentially disparate aggregate of categories having different locales. This done just for readability, as this extensive code in the middle of something else distracts from the main point. A goto is hence replaced by a recursive call. Commit: 347d40cf20eff3d73310c26d18a47b8740101c4f https://github.com/Perl/perl5/commit/347d40cf20eff3d73310c26d18a47b8740101c4f Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M locale.c M proto.h Log Message: ----------- locale.c: Change internal variable name The new name better reflects its purpose, so is less confusing Commit: 101c348aa955e1aebedc38536fc21a8510e108ad https://github.com/Perl/perl5/commit/101c348aa955e1aebedc38536fc21a8510e108ad Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Clean up handling of a glibc bug This commit moves all mention of this bug to just the code that requires it, and inlines a macro, making it easier to comprehend Commit: 42be4f01bb1eae7a82f733ec7732ab28e9a26fdd https://github.com/Perl/perl5/commit/42be4f01bb1eae7a82f733ec7732ab28e9a26fdd Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Split ancillary from S_emulate_setlocale This takes the code to update LC_ALL, used only in some Configurations, out of the main line, making the main line more readable. It also allows the removal of temporary code added a few commits back Commit: 1fb4939861a3e19c5d06d02645c01b63d6a47cac https://github.com/Perl/perl5/commit/1fb4939861a3e19c5d06d02645c01b63d6a47cac Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: locale "" can be disparate Setting a locale "" means to get the value from environment variables. These can set locale categories to different locales, and this needs to be handled. The logic before this commit only handled the disparate case when the locale wasn't ""; but this was compensated for elsewhere. A future commit will remove that compensation. Commit: 879505fbf40afd07d7ca0661c40d6b8db4056a03 https://github.com/Perl/perl5/commit/879505fbf40afd07d7ca0661c40d6b8db4056a03 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- Split off setting locale to "" from S_emulate_setlocale This is done for readability, to move the special casing of setting a locale to the empty string (hence getting it from the environment) out of the main line code. Commit: 3a21b9287907c677f68678dff99bbd2d53d08e60 https://github.com/Perl/perl5/commit/3a21b9287907c677f68678dff99bbd2d53d08e60 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M sv.c Log Message: ----------- sv.c: Duplicate more variables during cloning These locale-related ones should be getting initialized in the new thread, but be certain. Commit: bbb1e7c94afb0623077601d413595b333c22af1d https://github.com/Perl/perl5/commit/bbb1e7c94afb0623077601d413595b333c22af1d Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M embedvar.h M intrpvar.h M locale.c M makedef.pl M perl.c M proto.h M sv.c Log Message: ----------- locale.c: Add fcn to hide edge case undefined behavior The POSIX 2008 API has an edge case in that the result of most of the functions when called with a global (as opposed to a per-thread) locale is undefined. The duplocale() function is the exception which will create a per-thread locale containing the values copied from the global one. This commit just calls duplocale, if needed, and the caller need not concern itself with this possibility Commit: 20304bd3031170989ff3df11cc394c6f44adc519 https://github.com/Perl/perl5/commit/20304bd3031170989ff3df11cc394c6f44adc519 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Add DEBUGGING information These functions are called as expansions of macros. It may be useful to know where in the file the macro occurred. Commit: b86933b1e4c6d98950392525819a07b569c375e0 https://github.com/Perl/perl5/commit/b86933b1e4c6d98950392525819a07b569c375e0 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Separate out two Win fcns from a larger one This makes the larger one easier to understand, and prepares for possible independent calls to the two, which are potentially useful on their own. Commit: c66cf8766db093a2266fb33b70d8967ed1c4e627 https://github.com/Perl/perl5/commit/c66cf8766db093a2266fb33b70d8967ed1c4e627 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M ext/POSIX/POSIX.xs Log Message: ----------- POSIX.xs: Use macro to reduce complexity This #defines a macro and uses it to populate a structure, so that strings don't have to be typed twice. Commit: eec588ec430c8d3dbec52a822e9288e9ab2fa619 https://github.com/Perl/perl5/commit/eec588ec430c8d3dbec52a822e9288e9ab2fa619 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M ext/POSIX/POSIX.xs Log Message: ----------- POSIX.xs: White-space only Properly indent some nested preprocessor directives Commit: e2817a8308e7ec841bf23df79b4c20510cbf65fc https://github.com/Perl/perl5/commit/e2817a8308e7ec841bf23df79b4c20510cbf65fc Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M ext/POSIX/POSIX.xs M locale.c M proto.h Log Message: ----------- Move code from POSIX.xs to locale.c This avoids duplicated logic. Commit: 087ce69431729936e7c30de937c4b208ddbc05bc https://github.com/Perl/perl5/commit/087ce69431729936e7c30de937c4b208ddbc05bc Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Reorder cases in a switch This moves handling the CODESET to the end, as future commits will make its handling more complicated. The cases are now ordered so the simplest (based on the direction of future commits) are first Commit: 56d3cc7dffb0ccd7409e6335171bf6a988e0c9a7 https://github.com/Perl/perl5/commit/56d3cc7dffb0ccd7409e6335171bf6a988e0c9a7 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Make statics of repeated string constants These strings are (or soon will be) used in multiple places; so have just one definition for them. Commit: 79e0bd347bf0bc2b93420439543db56e3ac96887 https://github.com/Perl/perl5/commit/79e0bd347bf0bc2b93420439543db56e3ac96887 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Add two #defines This makes sure that we handle having any variant of nl_langinfo() or localeconv(). Commit: 599a38f5b7a45329ea3bcf8e8156abee4fdd1474 https://github.com/Perl/perl5/commit/599a38f5b7a45329ea3bcf8e8156abee4fdd1474 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Return defaults for uncomputable langinfo items Return the values from the C locale for nl_langinfo() items that aren't computable on this platform. If the platform has nl_langinfo(), then all of them are computable, but if not, some can't be computed, and others can be, but only if there are alternative methods available on the platform. As part of this commit, S_my_nl_langinfo() and S_save_to_buffer() are no longer used when USE_LOCALE is not defined, so don't compile them. Commit: 24d14fabd6020a43ab013384b3a889811ccef09b https://github.com/Perl/perl5/commit/24d14fabd6020a43ab013384b3a889811ccef09b Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Rmv reimplementation of my_strftime() Prior to this commit, there was a near duplicate copy of the code from util.c that implements my_strftime(). This was done because the util.c version zaps the wday field, which made it incompatible. But it dawned on me that if the arbitrary date we use to do our calculations were such that it was for a year in which January 1 falls on a Sunday, then the util.c version automatically works. Commit: df5946d02d4b8a8e633df9ad14ee25644f1a0146 https://github.com/Perl/perl5/commit/df5946d02d4b8a8e633df9ad14ee25644f1a0146 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Shorten static function name The extra syllable(s) are unnecessary noise Commit: 1562b0383e6bc1ebe583a74cf1d43c33557dc64c https://github.com/Perl/perl5/commit/1562b0383e6bc1ebe583a74cf1d43c33557dc64c Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M locale.c M proto.h Log Message: ----------- locale.c: Extend a static function This will allow it to be used in situations where the buffer it controls is single use, and we don't need to keep track of the size for future calls. Commit: da9d7d009958876f0e015921dd4bc02c0fe3f25c https://github.com/Perl/perl5/commit/da9d7d009958876f0e015921dd4bc02c0fe3f25c Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Use typedef to simplify This allows some preprocessor conditionals to be removed Commit: b13bd0fc0db1935bbcd2c92e112c35656aa8e2f7 https://github.com/Perl/perl5/commit/b13bd0fc0db1935bbcd2c92e112c35656aa8e2f7 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Rmv redundant cBOOL() strEQ and && already return booleans Commit: 8e70b39387c4878e3a9fc2bd89ba7ed320e1bacd https://github.com/Perl/perl5/commit/8e70b39387c4878e3a9fc2bd89ba7ed320e1bacd Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Fix currency symbol derivation On platforms without nl_langinfo(), we derive the currency symbol from localeconv(). The symbol must be tweaked to conform to nl_langinfo() standards. Prior to this commit, it guessed at how to tweak a rare circumstance. I now have seen evidence this guess was wrong, so give up on it. This also no longer returns just an empty string in certain cases. nl_langinfo() itself doesn't, so conform to that. Commit: f687514f5b6563c32eae7b259fa3a4ccbc8b6c00 https://github.com/Perl/perl5/commit/f687514f5b6563c32eae7b259fa3a4ccbc8b6c00 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Don't add CP to Windows code page names The actual name appears to be just the number for purposes of nl_langinfo()-ish things. Commit: b70bc7d6e88ef68ba57e110e38ac8c0a68d53c0d https://github.com/Perl/perl5/commit/b70bc7d6e88ef68ba57e110e38ac8c0a68d53c0d Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M locale.c M proto.h Log Message: ----------- locale.c: Don't ask a static fcn to be inlined It's too complicated to really be inlined, and the compiler can figure things out itself given it is a static function Commit: 3736101e86a12f38715f3fb388ba74dad933a723 https://github.com/Perl/perl5/commit/3736101e86a12f38715f3fb388ba74dad933a723 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M locale.c M proto.h Log Message: ----------- locale.c: Rmv no longer used param from static fnc Previous commits have gotten rid of this parameter to S_save_to_buffer Commit: 8552dec5a1204995f746b7df57ee31704a4f584c https://github.com/Perl/perl5/commit/8552dec5a1204995f746b7df57ee31704a4f584c Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Don't change locale if already there Changing the locale is cheap for some categories, but expensive for others. Changing LC_COLLATE is most expensive, requiring recalculation of the collation transformation mapping. This commit checks before blindly changing locales that we aren't already in the desired one, in which case this could be just as well a no-op, and with this commit becomes one. Commit: f2537d1feadea1cc2125185a73f402f3f913f32f https://github.com/Perl/perl5/commit/f2537d1feadea1cc2125185a73f402f3f913f32f Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M intrpvar.h M locale.c M proto.h Log Message: ----------- Make two locale PL_ strings const char* This adds some compile safety to these. Commit: 7fce4846cc85e3e75f521eabf28870952e53d8cf https://github.com/Perl/perl5/commit/7fce4846cc85e3e75f521eabf28870952e53d8cf Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Use a scratch buf; instead of resuing old This is in preparation for the next commit Commit: bd4029fdaaf9884c4f0d7d01a04aa90a79fef56c https://github.com/Perl/perl5/commit/bd4029fdaaf9884c4f0d7d01a04aa90a79fef56c Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Make static fcn reentrant This makes my_langinfo() reentrant by adding parameters specifying where to store the result. This prepares for future commits, and fixes some minor bugs for XS writers, in that the claim was that the buffer in calling Perl_langinfo() was safe from getting zapped until the next call to it in the same thread. It turns out there were cases where, because of internal calls, the buffer did get zapped. Commit: b0f8be00838f0fac35d05a5a78f0a00e7cf5bda6 https://github.com/Perl/perl5/commit/b0f8be00838f0fac35d05a5a78f0a00e7cf5bda6 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: langinfo: Use Windows fcn to find CODESET There is a Windows function available for quite a long time that will return the current code page. Use this for the nl_langinfo() CODESET, as that libc function isn't implemented on Windows. If for some unlikely reason this fails, drop down to the existing code that gets the code page from the locale name. Commit: e2a7600105f106e9cf9007aeffedb590de9eb4a6 https://github.com/Perl/perl5/commit/e2a7600105f106e9cf9007aeffedb590de9eb4a6 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Add static fcn to analyze locale codeset It determines if the name indicates it is UTF-8 or not. There are several variant spellings in use, and this hides that from the the callers. It won't be actually used until the next commit Commit: 5bfe0da50ba260057af42048ca6dcc08683d311e https://github.com/Perl/perl5/commit/5bfe0da50ba260057af42048ca6dcc08683d311e Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M ext/I18N-Langinfo/Langinfo.pm M locale.c Log Message: ----------- locale.c: Improve non-nl_langinfo() CODESET calc Prior to this commit, on non-Windows platforms that don't have a nl_langinfo() libc function, the code completely punted computation of the CODESET item. I have not been able to figure out how to do this, even going to the locale definition files on disk (which may vary anyway), but we can do a lot better than punting. This commit adds three checks: 1) If the locale name is C or POSIX, we know the codeset 2) We can detect if a locale is UTF-8. If it is, that is the codeset. Many modern locales are of this ilk. 3) Failing that, some locales have the codeset appear in the name, following a dot. It isn't perfect, but it's a lot better than completely punting. Commit: 2e2f2253cb0df4a043ce9943cf3920ab579e28a2 https://github.com/Perl/perl5/commit/2e2f2253cb0df4a043ce9943cf3920ab579e28a2 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- New signature for static fcn my_langinfo() This commit changes the calling sequence for my_langinfo to add the desired locale (or a sentinel to indicate to use the current locale), and the locale category of the desired item. This allows the function to be able to return the desired value for any locale, avoiding some locale changes that would happen until this commit, and hiding the need for locale changes from outside functions, though a couple continue to do so to avoid potential multiple changes. Commit: 53d1beb66d698a6f31cf655f4e6b207fdb349014 https://github.com/Perl/perl5/commit/53d1beb66d698a6f31cf655f4e6b207fdb349014 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Add is_locale_utf8() Previous commits have added the infrastructure to be able to determine if a locale is UTF-8. This will prove useful, and this commit adds a function to encapsulate this information, and uses it in a couple of places, with more to come in future commits. This uses as a final fallback, mbtowc(), which some sources view was a late adder to C89, and others as not really being available until C99. Future commits will add heuristics when that function isn't available. Commit: f5570c1ae8b35f7f66d93d66ef1f8e0651900dbd https://github.com/Perl/perl5/commit/f5570c1ae8b35f7f66d93d66ef1f8e0651900dbd Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Add fcn for UTF8ness determination get_locale_string_utf8ness() will determine if the string it is passed in the locale it is passed is to be treated as UTF-8, or not. Commit: 6c8d7e6bf7dc8bd2d327b9626193247d43d25a4b https://github.com/Perl/perl5/commit/6c8d7e6bf7dc8bd2d327b9626193247d43d25a4b Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M ext/POSIX/POSIX.xs M locale.c M proto.h Log Message: ----------- XXX perldelta Move POSIX::localeconv() logic to locale.c The code currently in POSIX.xs is moved to locale.c, and reworked some to fit in that scheme, and the logic for the workaround for the Windows broken localeconv() is made more robust. This is in preparation for the next commit which will use this logic instead of (imperfectly) duplicating it. This also creates Perl_localeconv() for direct XS calls of this functionality. Commit: 4640c2f4599c02c7c2a6cc3a1ce574ff5c49f1d3 https://github.com/Perl/perl5/commit/4640c2f4599c02c7c2a6cc3a1ce574ff5c49f1d3 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Collapse duplicate logic into one instance The previous commit move the logic for localeconv() into locale.c. This commit takes advantage of that to use it instead of repeating the logic. On Windows, there is alternative way of finding the radix character for systems that have a localeconv() that could cause a race. Prior to this commit, if that failed to find something that looked like the radix, it returned a '?'. Now it will drop down to using this new code, as the likelihood of the race is small. Notably, this commit removes the inconsistent duplicate logic that had been used to deal with the Windows broken localeconv() bug. Commit: eb8f58e4bd20d56d458d8de99537d3f26f8a06c4 https://github.com/Perl/perl5/commit/eb8f58e4bd20d56d458d8de99537d3f26f8a06c4 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Fix windows bug with broken localeconv() localeconv() was broken on Windows until VS 2015. As a workaround, this was using my_snprintf() to find what the decimal point character is, trying to avoid our workaround for localeconv(), which has a (slight) chance of a race condition. The problem is that my_snprintf() might not end up calling snprintf at all; I didn't trace all possibilities in Windows. So it doesn't make for a reliable sentinel. This commit now specifically uses libc snprintf(), and if it fails, drops down to try localeconv(). Commit: d17192e2275ccc0ba24b5e61004a6b77161c1c59 https://github.com/Perl/perl5/commit/d17192e2275ccc0ba24b5e61004a6b77161c1c59 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M ext/POSIX/POSIX.xs M locale.c M proto.h Log Message: ----------- XXXdelta Add my_strftime8() This is like plain my_strftime(), but additionally returns an indication of the UTF-8ness of the returned string Commit: d932725d5764ae9ae1ba93de5a5128ab20d453ef https://github.com/Perl/perl5/commit/d932725d5764ae9ae1ba93de5a5128ab20d453ef Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Add utf8ness return param to static fcn my_langinfo_i() now will additionally return the UTF-8ness of the returned string. Commit: fb07d92ccc7635114a1fd13a661749956882bba9 https://github.com/Perl/perl5/commit/fb07d92ccc7635114a1fd13a661749956882bba9 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M ext/I18N-Langinfo/Langinfo.xs M locale.c M proto.h Log Message: ----------- XXXdelta Add Perl_langinfo8() This is like Perl_langinfo() but additionally returns information about the UTF-8ness of the returned string. Commit: ce3b98d52ef04ea64980de99692243d9c1e07b39 https://github.com/Perl/perl5/commit/ce3b98d52ef04ea64980de99692243d9c1e07b39 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Add fallbacks if no mbtowc() This add heuristics that work well for non-English locales to determine if a locale is UTF-8 or not when mbtowc() isn't available. It would be a very rare compiler that didn't have that these days, but this covers that case as best as I have been able to figure out. Commit: 82374649074a34494a4502e9ce4724c5fa37b010 https://github.com/Perl/perl5/commit/82374649074a34494a4502e9ce4724c5fa37b010 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Use Strerror(), not strerror() Commit: 1ccff88ced4f9b6301027f7a61a3eff28e333db3 https://github.com/Perl/perl5/commit/1ccff88ced4f9b6301027f7a61a3eff28e333db3 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Refactor #ifdef's for clarity The my_strerror() function has effectively 5 different implementations depending on the capabilities of the platform. Only a few lines are common to all, the set-up and the return. The #ifdefs obscure the underlying logic. So this commit separates them out into 5 different functions, with the result that it's clear what is going on in each. Commit: 43ba2ebf42a5b0873bedcd485182a428b54db9af https://github.com/Perl/perl5/commit/43ba2ebf42a5b0873bedcd485182a428b54db9af Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- Avoid mojibake in "$!" In stress testing, I discovered that the LC_CTYPE and LC_MESSAGES locales need to be the same locale, or strerror() can return question marks or mojibake instead of the proper message. This commit refactors the handling of stringifying "$!" to make the locales of both categories the same during the stringification. Actually, I suspect it isn't the locale, but the codeset of the locale that needs to be the same. I suspect that if the categories were both in different UTF-8 locales, or both in single-byte locales, that things would work fine. But it's cheaper to find the locale rather than the locale's codeset, so that is what is done. Commit: 5bc2ed9316095eab1f9d9daa630d5c047a1aa34a https://github.com/Perl/perl5/commit/5bc2ed9316095eab1f9d9daa630d5c047a1aa34a Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M mg.c M proto.h Log Message: ----------- Move utf8ness calc for $! into locale.c from mg.c locale.c has the infrastructure to handle this, so remove repeated logic. The removed code tried to discern better based on using script runs, but this actually doesn't help, so is removed. Commit: bcfc166818817ae672bc8e8d35743de02f7fe65c https://github.com/Perl/perl5/commit/bcfc166818817ae672bc8e8d35743de02f7fe65c Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M mg.c Log Message: ----------- mg.c: White-space only Indent newly formed block from the previous commit. Commit: 2354317dc8f406f57a3a723518174c0b4ce2e329 https://github.com/Perl/perl5/commit/2354317dc8f406f57a3a723518174c0b4ce2e329 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M embedvar.h M intrpvar.h M locale.c M proto.h M sv.c Log Message: ----------- locale.c: Rmv no longer used code; UTF8ness cache What these functions do has been subsumed by code introduced in previous commits, and in a more straight forward manner. Also removed in this commit is the cache of the knowing what locales are UTF-8 or not. This data is now cheaper to calculate when needed, and there is now a single entry cache, so I don't think the complexity warrants keeping it. It could be added back if necessary, split off from the remainder of this commit. Commit: b0663a5dcadd4318f7553468966122f40c716238 https://github.com/Perl/perl5/commit/b0663a5dcadd4318f7553468966122f40c716238 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- Don't discard locale info in starting P2008 The program is started in the global locale, and then is converted to the POSIX 2008 per-thread locale API. Prior to this commit the startup locale was discarded. It really should be the foundation for the 2008 locales. I don't know of any current paths through the code that this makes a difference for, but it is a potential hole that is easy to plug. Commit: 2b90ef1de107c86128f34ab0c8aece9f8bae2dd2 https://github.com/Perl/perl5/commit/2b90ef1de107c86128f34ab0c8aece9f8bae2dd2 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M locale.c M perl.h M proto.h Log Message: ----------- Add a common locale panic macro and function This will make sure that all the necessary clean up gets done. Commit: 2b78e25e9f94ff30bd595b8da76029b5538f950c https://github.com/Perl/perl5/commit/2b78e25e9f94ff30bd595b8da76029b5538f950c Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Revamp sync_locale() This rarely used function was actually failing to do what it purported in some Configurations. Commit: d6d0fb61a093cb322184afe60793ecc5d1e65eee https://github.com/Perl/perl5/commit/d6d0fb61a093cb322184afe60793ecc5d1e65eee Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Clean up thread_locale_init() We can use internal functions to this file instead of the API ones here. This commit also calls sync_locale() to avoid repeated logic. Commit: 7efe87b27abcbd873d75df6351c36464c8b4e2ed https://github.com/Perl/perl5/commit/7efe87b27abcbd873d75df6351c36464c8b4e2ed Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- Revamp switch_to_global_locale() Prior to this commit, the global locale was not always getting populated with the values from the thread being switched. Commit: 84f2b242070a3fd23f53e13a9902f33f3dad16c3 https://github.com/Perl/perl5/commit/84f2b242070a3fd23f53e13a9902f33f3dad16c3 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Omit an extra copy In this case in Perl_setlocale(), we can just return the plain result from setlocale(), as, if something further needs to be done that would destroy it, that is taken care of already at the time. On per-thread locale platforms, the result already is in a per-category buffer. Commit: b53b6365cc8c39d24bd035a5299930ffd9795e51 https://github.com/Perl/perl5/commit/b53b6365cc8c39d24bd035a5299930ffd9795e51 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embedvar.h M intrpvar.h M locale.c M makedef.pl M perl.c M sv.c Log Message: ----------- locale.c: Cache the current LC_CTYPE locale name This is now used as a cache of length 1 to avoid having to lookup up the UTF-8ness as often. There was a complicated cache previously, but changes to the logic caused that to be much less necessary, and it is no longer actually used, and will be removed in a later commit. But it's pretty easy to keep this single value around to cut further down the new scheme's need to look it up Commit: 24b3d5e37f242428bba591fa8308119f84f0a0f0 https://github.com/Perl/perl5/commit/24b3d5e37f242428bba591fa8308119f84f0a0f0 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M intrpvar.h Log Message: ----------- intrpvar.h: Initialize a variable I don't believe there is a bug with this PL_numeric_name being uninitialized, but this is an easy precaution. Commit: 1c0320711144e225dc18ca330b8cd21d87542162 https://github.com/Perl/perl5/commit/1c0320711144e225dc18ca330b8cd21d87542162 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c M perl.h Log Message: ----------- Swap the ordering of two locale category indices Perl internally uses a mapping of locale category values into a consecutive sequence of indices starting at 0. These are used as indexes into arrays. The reason is that the category numbers are opaque, vary by platform, aren't necessarily sequential, and hence are hard to make table driven code for. This commit makes the LC_CTYPE index 0, and LC_NUMERIC equal to 1; swapping them. The reason is to cause LC_CTYPE to get done first in the many loops through the categories. The UTF8ness of categories is an often needed value, and most of the time the categories will have the same locale. LC_CTYPE is needed to calculate the UTF8ness, and by doing it first and caching the result, the other categories likely automatically will use the same value, without having to recalculate. Commit: 23f685a0195c056124cc3e8d78e9e0166484a78a https://github.com/Perl/perl5/commit/23f685a0195c056124cc3e8d78e9e0166484a78a Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Use new mechanism to save/restore errno Instead of explicitly saving the errno around debugging statements, the new more general mechanism is used. Commit: e7b018bec2b738f39bd9bf1cbb66ce7d6029d2b8 https://github.com/Perl/perl5/commit/e7b018bec2b738f39bd9bf1cbb66ce7d6029d2b8 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Move DEBUG location info This commit takes advantage of the new mechanism to add common DEBUGGING code to print the __FILE__ and __LINE__ of every debugging statement. This allows those to be removed from each statement, and have them implicitly added. This make things consistent, and easier to read and add new statements. Commit: dc9d896cc731a56e3bdfdac4b2f0e1533ea93688 https://github.com/Perl/perl5/commit/dc9d896cc731a56e3bdfdac4b2f0e1533ea93688 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Add some asserts Commit: 6910edcd475b0942303d4f9209e1c960dbed16e9 https://github.com/Perl/perl5/commit/6910edcd475b0942303d4f9209e1c960dbed16e9 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Reorder code, rmv unneeded conditional Previous commits have made the conditional about being able to find the radix character unnecessary. The called function my_langinfo_c() handles the case properly. This commit also makes the trivial case first in a conditional, as that is easier to comprehend. Commit: dd07c04e78f2c67c67ce4849d6c186b3609a1201 https://github.com/Perl/perl5/commit/dd07c04e78f2c67c67ce4849d6c186b3609a1201 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Reorder 'if' branches It's better for understandability to have positive tests than negative ones Commit: 2ea1edb2c864385382962127d08d13ca9d33c28b https://github.com/Perl/perl5/commit/2ea1edb2c864385382962127d08d13ca9d33c28b Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Refactor a static function S_new_numeric() is called after the LC_NUMERIC category is changed, to update various ancillary information Perl keeps. This reorders the function so that on POSIX 2008 platforms, the numeric object is created earlier. This allows for fewer operations on those platforms, as we already have the correct value in place for querying what the radix and thousands separator characters are. Explanatory comments are also added. Commit: 0cfa94566a008231ac65b3e4f7d57beaf1e367ba https://github.com/Perl/perl5/commit/0cfa94566a008231ac65b3e4f7d57beaf1e367ba Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M locale.c Log Message: ----------- locale.c: Change assert() into STATIC_ASSERT() Commit: d9cd036bc16e3343027d2970df536d9f569a92a2 https://github.com/Perl/perl5/commit/d9cd036bc16e3343027d2970df536d9f569a92a2 Author: Karl Williamson <k...@cpan.org> Date: 2021-03-03 (Wed, 03 Mar 2021) Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- f Compare: https://github.com/Perl/perl5/compare/8aff6ba1a14f...d9cd036bc16e