Branch: refs/heads/blead Home: https://github.com/Perl/perl5 Commit: dd8f68333d2cb230ef48e102ea415281cc409d44 https://github.com/Perl/perl5/commit/dd8f68333d2cb230ef48e102ea415281cc409d44 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023)
Changed paths: M embed.fnc M embed.h M locale.c M proto.h Log Message: ----------- locale.c: Rename to S_calculate_LC_ALL_string() Its return is a string. Add the suffix '_string' to emphasize that Commit: 3b4487e6811232d228d5799b7a448aac41976cdc https://github.com/Perl/perl5/commit/3b4487e6811232d228d5799b7a448aac41976cdc Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Use proper macro querylocale_c() likely will expand to the correct thing, but it isn't defined until higher in the stack of locale handling layers. Instead use the construct that is lower in the stack. Commit: 2270e95d8e1ac63276bd5031abef91c3e02a6009 https://github.com/Perl/perl5/commit/2270e95d8e1ac63276bd5031abef91c3e02a6009 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Don't compile Win32 setlocale if no locales If we are compiled to ignore locales, there is no need to compile the code that handles changing them. Commit: f1154b6ef2100bfd4afa8c9e6e665008dc78df16 https://github.com/Perl/perl5/commit/f1154b6ef2100bfd4afa8c9e6e665008dc78df16 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Fix Win32 compile if LC_(NUMERIC|MONETARY) missing It's unlikely, but legal, to have one of these categories missing on a platform; prior to this commit, it would generate a segfault trying to build perl. Commit: 23fde7fcdf289a02e8051f7ec77653e5a64ab00c https://github.com/Perl/perl5/commit/23fde7fcdf289a02e8051f7ec77653e5a64ab00c Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Add STATIC to two S_ function declarations Commit: 7d484a23531c8e572410b573eec0733a893752d9 https://github.com/Perl/perl5/commit/7d484a23531c8e572410b573eec0733a893752d9 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Add some DEBUG statements I have found these useful. Commit: e8a08fd22094e2ce5b19674543ccdcb3240f50e1 https://github.com/Perl/perl5/commit/e8a08fd22094e2ce5b19674543ccdcb3240f50e1 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Move some static functions within file This places them more conveniently. Future commits will continue this reordering until like-level and like-kind functions are close to each other physically in the file. Commit: e628bfc838bab2f96a62fe4b4f174ff59ef16a5a https://github.com/Perl/perl5/commit/e628bfc838bab2f96a62fe4b4f174ff59ef16a5a Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Create a longer unbroken #ifdef scope This code is not needed when USE_LOCALE is not defined, and hence should not be compiled. This commit revises some #ifdef's to create a longer stretch of functions that should thus be skipped. S_find_locale_from_environment() is marked in embed.fnc as not to be compiled without USE_LOCALE, but that #ifdef was missing in locale.c. Now it is absorbed into the long scope. Preprocessor directives indentation is adjusted as a result of this change, and to correct previous mistakes in it. Commit: 20538ff7f6898665a062ad1b8507b5d6796a7b91 https://github.com/Perl/perl5/commit/20538ff7f6898665a062ad1b8507b5d6796a7b91 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M embed.fnc M embed.h M locale.c M perl.h M proto.h Log Message: ----------- Change name of private function, and when compiled The previous short name '_warn_problematic_locale' begins with an underscore, which is reserved for the platform's implementation. This commit gets rid of the short name, which allows us to not need an underscore which was used purely to avoid namespace clashes wih XS code. The function is designed to only be called from a single macro, defined only in core and Perl extensions. It further doesn't get called unless LC_CTYPE is to be used on the platform. So restrict its definition to that. Commit: 92d901fd7df81894942a735b5e9ad2618c3e44ee https://github.com/Perl/perl5/commit/92d901fd7df81894942a735b5e9ad2618c3e44ee Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Replace an assumption by a cpp check This commit adds a preprocessor directive to check if we are running on a POSIX 2008 system, rather than just assume we are if the earlier possibilities weren't the case. And it causes a compile time error if none pan out. Commit: 135517aa81f583f0ba2b69829abeaba0cbdd1ead https://github.com/Perl/perl5/commit/135517aa81f583f0ba2b69829abeaba0cbdd1ead Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Don't compile without LC_ALL under POSIX 2008 The code assumes that if you have POSIX 2008, you have LC_ALL. This adds a compile-time error check to prevent someone from finding that out the harder way. Commit: acd1a7e74f5fab02cc267796ce7c75b79eacb44a https://github.com/Perl/perl5/commit/acd1a7e74f5fab02cc267796ce7c75b79eacb44a Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Move a parallel array adjacent to its mates This is in preparation for making their parallelism more obvious Commit: 31db2049c3633a5a668a7aaa54a7cfc79fb7439a https://github.com/Perl/perl5/commit/31db2049c3633a5a668a7aaa54a7cfc79fb7439a Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Properly identify reason for placeholder in arrays This is needed to handle the case where a locale category passed in (via Perl_setlocale) is unknown to perl, hence is considered illegal. The previous comments were misleading. Commit: 2e93c643aa479652a3c9cc159ee46e2c594bb084 https://github.com/Perl/perl5/commit/2e93c643aa479652a3c9cc159ee46e2c594bb084 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M embed.fnc M locale.c M proto.h Log Message: ----------- Change return of S_get_category_index_nowarn This is in preparation for it being called from more than a single place. Instead of returning -1 on error, it returns an out-of-bounds value 1 greater than the largest legal value. There is a placeholder entry in all the arrays this can be indexed into for that illegal value. This means if it somehow gets used, we wont get a segfault, like we would on the -1, but instead a value that will show up as wrong, but not crash. Commit: c22ada12fc5d70b5107da5600135ee970c3d27f1 https://github.com/Perl/perl5/commit/c22ada12fc5d70b5107da5600135ee970c3d27f1 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M ext/XS-APItest/t/locale.t M locale.c Log Message: ----------- locale.c: Check for illegal input category It is possible for Perl_setlocale() to be called with a category value that is illegal, or is just unknown to us. There is a function that maps category numbers into our internal indexing scheme. It maps any unknown value to the same index, larger than any legal one. Prior to this commit, there was no check that the input was valid; we went off processing it as if it were valid. That there was an element in the tables that corresponds to this index prevented any illegal memory acceses, but it is better to check early and return an error. Since we compute the internal index for the category earlier in the function, we can use the '_i' form of the internal calls rather than calculating the index again. Commit: 46d320ba47092ae36d3e972057e530f55ded78d7 https://github.com/Perl/perl5/commit/46d320ba47092ae36d3e972057e530f55ded78d7 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M MANIFEST M locale.c A locale_table.h Log Message: ----------- locale.c: Revamp initialization of parallel arrays This new method, suggested by Tony Cook, uses a header file to hold the locale categories used on this system, each as a call to a macro with the correct parameters for that category. When a data structure needs to use the categories, it re-#defines the macro to generate the data it needs and #includes the header. This guarantees that the various parallel arrays, are in fact parallel. This method eliminates a lot of #ifdef's in each of the data structure initializations. Commit: a63ba983ed3db8a22e590abc43751d991c27d7a4 https://github.com/Perl/perl5/commit/a63ba983ed3db8a22e590abc43751d991c27d7a4 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Avoid runtime strlen() calls The lengths of these strings are known at compile time. This commit creates an array of those lengths to avoid calling strlen() in a loop unnecessarily. Commit: 54dc52efdf252c8971c03f4e516025af3a2683bd https://github.com/Perl/perl5/commit/54dc52efdf252c8971c03f4e516025af3a2683bd Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c Log Message: ----------- locale.c: Replace loop with a switch() locale.c uses tables to specify data and actions about the different locale categories on the system. The categories are opaque integers specified by libc, so they have to be mapped to indices into the tables for our use. Prior to this commit, that was done by a loop iterating over each possibility until it found a match. This commit changes that to use a switch() statement, so that the compiler can choose what the best way to implement things are. Commit: a2d04a5251e8e0c441a5c12ede6c00b49c7403b4 https://github.com/Perl/perl5/commit/a2d04a5251e8e0c441a5c12ede6c00b49c7403b4 Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M embed.fnc M embed.h M ext/XS-APItest/t/locale.t M locale.c M proto.h Log Message: ----------- locale.c: Refactor S_get_category_index() There is actually only one place where the locale category can be input from code outside this file. Now that the previous commit added validation to that one spot, The rest of the calls should already be validated, and if the input is bad, it means that there is a serious error in the logic of this code, and warrants panicking. This commit collapses two functions into one plus a macro to call it with the right parameters. It moves the warning into the one place where it is useful, and panics if there is a problem otherwise. And it adds tests for the warning. Commit: e4b22cb7fc00a50270d8d791b4e67f718697b2dc https://github.com/Perl/perl5/commit/e4b22cb7fc00a50270d8d791b4e67f718697b2dc Author: Karl Williamson <k...@cpan.org> Date: 2023-07-24 (Mon, 24 Jul 2023) Changed paths: M locale.c M perl.h Log Message: ----------- Rename SETLOCALE_LOCK to LOCALE_LOCK This mutex isn't just about the setlocale function; it applies to all locale related critical sections. There are no uses of SETLOCALE_LOCK in CPAN Compare: https://github.com/Perl/perl5/compare/9bcd703683fe...e4b22cb7fc00