develooper Front page | perl.perl5.changes | Postings from March 2021

[Perl/perl5] c63289: XXX craig Unixish.h, doshish.h: Reorderterminatio...

From:
Karl Williamson via perl5-changes
Date:
March 30, 2021 23:09
Subject:
[Perl/perl5] c63289: XXX craig Unixish.h, doshish.h: Reorderterminatio...
Message ID:
Perl/perl5/push/refs/heads/smoke-me/khw-locale/28b6e9-2ea6fb@github.com
  Branch: refs/heads/smoke-me/khw-locale
  Home:   https://github.com/Perl/perl5
  Commit: c63289791d008a03d36b9c4ae57bfdeeb2610f4e
      https://github.com/Perl/perl5/commit/c63289791d008a03d36b9c4ae57bfdeeb2610f4e
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M dosish.h
    M unixish.h

  Log Message:
  -----------
  XXX craig Unixish.h, doshish.h: Reorder terminations; simplify

The IO and memory terminations need to be after other things.  Add a
comment so that future maintainers won't make the mistakes I did.

Also refactor to that amiga os doesn't have a separate list to get out
of sync

I suspect that the amiga termination should be moved to earlier in
the sequence, but absent any evidence; I'm leaving it unchanged.


  Commit: b6d1bf062cd39e0237714f3a53e19dcce8120fd3
      https://github.com/Perl/perl5/commit/b6d1bf062cd39e0237714f3a53e19dcce8120fd3
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Win32: Don't check folds validity

This code will check, when warnings are on, that the libc functions
return valid values.  But Windows platforms will always fail because
they have multiple divergences from the Posix standard.  The macros that
implement the case changing/folding in handy.h take extra steps to bring
Windows code more into alignment with Posix.  Those are too complicated
to easily duplicate the logic here.  The result of these checks is
looked at by our test suite, which has long, without anyone noticing,
skipped portions on Windows, even though handy.h should correct for
this.  So simply, don't do the checking under Windows, and find out what
handy.h has failed to fully correct for.


  Commit: bddf5fe24f4a0366acc801f75a41147f2a22f19b
      https://github.com/Perl/perl5/commit/bddf5fe24f4a0366acc801f75a41147f2a22f19b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M lib/locale_threads.t

  Log Message:
  -----------
  XXX locale_threads


  Commit: bf85e31c7bc8e241ffc29a32ab3580df01bcd5fd
      https://github.com/Perl/perl5/commit/bf85e31c7bc8e241ffc29a32ab3580df01bcd5fd
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 81abd810ee3e23b5281f0b4dee6e33ac92aa35d7
      https://github.com/Perl/perl5/commit/81abd810ee3e23b5281f0b4dee6e33ac92aa35d7
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 314b3267445b156ef7ab3db12ecac9b90abe7a46
      https://github.com/Perl/perl5/commit/314b3267445b156ef7ab3db12ecac9b90abe7a46
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h
    M numeric.c
    M regcomp.c
    M regexec.c
    M utfebcdic.h

  Log Message:
  -----------
  Change handy.h 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: dcc300ed53c51e539e88033ea4f468467fefd508
      https://github.com/Perl/perl5/commit/dcc300ed53c51e539e88033ea4f468467fefd508
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Remove only 2 calls to an internal macro

Replace isIDFIRST_LC and isWORD_CHAR_LC isIDFIRST_LC  with slightly
faster implementations.


  Commit: 691c5410fe5a5e28afe7fa474d5e4d31ce9c9b51
      https://github.com/Perl/perl5/commit/691c5410fe5a5e28afe7fa474d5e4d31ce9c9b51
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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 isIDFIRST_LC and isWORDCHAR_LC definitions for
non-Windows to match that platform superficially, though expanding to
what it previously did to.


  Commit: 8330f48c6841dae4c5bb6eca166edf69b0e121e1
      https://github.com/Perl/perl5/commit/8330f48c6841dae4c5bb6eca166edf69b0e121e1
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Add some branch predictions


  Commit: 055e77760e81b7f336e2a831054532d13d693218
      https://github.com/Perl/perl5/commit/055e77760e81b7f336e2a831054532d13d693218
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: White-space, comment only


  Commit: dfd7c47432758579a398450bbbf4d3c2e90ec2b7
      https://github.com/Perl/perl5/commit/dfd7c47432758579a398450bbbf4d3c2e90ec2b7
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Don't use char class if no LC_CTYPE

It is possible to compile perl to not pay attention to LC_CTYPE.  This
was testing for no locales at all; whereas the stricter requirement
should be used.


  Commit: bb879e66ad771d3f734188c244d33496bb8b1963
      https://github.com/Perl/perl5/commit/bb879e66ad771d3f734188c244d33496bb8b1963
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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 handy.h 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: dfc7ef7dfc7bc6c08afd59ba7ab531e587d67cbf
      https://github.com/Perl/perl5/commit/dfc7ef7dfc7bc6c08afd59ba7ab531e587d67cbf
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Rmv internal macro

LC_CAST_ was my attempt at generality, but I didn't realize that the
POSIX standard specifies the type that this was meant to generalize, so
there isn't any need for it.


  Commit: 4e81dcdb73c47852a1c68c1acbe07d3dddd3e385
      https://github.com/Perl/perl5/commit/4e81dcdb73c47852a1c68c1acbe07d3dddd3e385
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: ada40b6515b18a7a71e73f2173233d70d171e76b
      https://github.com/Perl/perl5/commit/ada40b6515b18a7a71e73f2173233d70d171e76b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Rmv unnecessary parameter to internal macros

The cast is required to be U8 by the POSIX standard.  There is no need
to have this added generality.


  Commit: 6096511a35c559caf18ee76b8ad68be07f8b546b
      https://github.com/Perl/perl5/commit/6096511a35c559caf18ee76b8ad68be07f8b546b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: #define one macro in terms of another

These two macros are equivalent as folding and lowercasing are the same
for this input domain.  Better to say so rather than to replicate the
definitions.


  Commit: 4ac2c318890898958827bdbc12431bc2bf005c31
      https://github.com/Perl/perl5/commit/4ac2c318890898958827bdbc12431bc2bf005c31
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  No locales => don't use isspace(), toLower() etc.

This commit changes what happens on platforms without locale handling to
use our precomputed definitions of what the various character class
definitions and case changing operations are.  Previously, it just
called the libc locale-dependent functions and made sure the result was
ASCII.  I think this is a holdover from before we had the precomputed
definitions


  Commit: 9dcf0a945fffafdafd593f29fb189a21125a90b9
      https://github.com/Perl/perl5/commit/9dcf0a945fffafdafd593f29fb189a21125a90b9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Collapse two sets of macros

By redefining a wrapper macro used in one set based on compile-time
info; the other set can be defined in terms of it, and the separate
entries removed.


  Commit: 6bbce157fa661f371590293688c3e960b9fefd38
      https://github.com/Perl/perl5/commit/6bbce157fa661f371590293688c3e960b9fefd38
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Move some macro defns around

This is to make the difference listing in future commits smaller.

This change includes some comment changes, and some extra parens around
some subexpressions


  Commit: 60c1d6410bf487039091f800da42b621cfab4ad1
      https://github.com/Perl/perl5/commit/60c1d6410bf487039091f800da42b621cfab4ad1
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Collapse some macros

These 3 sets of macros can be collapsed trivially into 3 macros.


  Commit: 23848294c3d8b422abcebea92d570c4e7834ffaa
      https://github.com/Perl/perl5/commit/23848294c3d8b422abcebea92d570c4e7834ffaa
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Add wrapper layer macros for isalnum() ...

This adds a new set of macros, forming a lower layer to what is currently
there to wrap the character classification libc functions, isdigit()
etc, and case changing ones, tolower(), toupper().

On most platforms these expand simply to the libc function call.  But on
windows, they expand to something more complex, to bring the Windows
calls into POSIX compliance.  Previously that was achieved at the higher
level, with the result that lower level calls were broken.  This
resulted in parts of the test suite being skipped on Windows.

The current level is rewritten to use the new lower layer, with the
result that it is simpler, as the complexity is now done further down.

I thought about calling these macros is_porcelain_isalnum or something
similar to emphaisze that they are close to the bare libc version, but
thought isU8_alnum() is shorter and conveys another truth, that being
the input is assumed to be a byte, without checking.


  Commit: 1c06bba326d3e259e071d9ce13791eed65986bd0
      https://github.com/Perl/perl5/commit/1c06bba326d3e259e071d9ce13791eed65986bd0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c
    M vms/vms.c

  Log Message:
  -----------
  locale.c: Use new macros from the prev commit

This should result in Windows boxes now passing the locale sanity
checks.  Previously that failure would cause the test suite tests to be
skipped, and warnings generated to Windows users that actually were
invalid, as the flaws were actually compensated for in other code.


  Commit: cada4de15dd6b0df8ff197e2f2232fe35e1689b6
      https://github.com/Perl/perl5/commit/cada4de15dd6b0df8ff197e2f2232fe35e1689b6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  XXX SEE IF WORKS handy.h: Change Windows macros


  Commit: a0f6adc2e2d5894ce3131c4fb0f5b495770bdfcb
      https://github.com/Perl/perl5/commit/a0f6adc2e2d5894ce3131c4fb0f5b495770bdfcb
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Add isCASED_LC

As a convenience to other code.


  Commit: c181a62547a61e7e1353123092c7471c3893d61e
      https://github.com/Perl/perl5/commit/c181a62547a61e7e1353123092c7471c3893d61e
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M regexec.c

  Log Message:
  -----------
  regexec.c: Improve code

These case statements in a switch all had the same prelude for checking
if the locale is UTF-8 and handling that case separately.  A few commits
ago created macros closer to the base level.  This commit factors out
the common UTF-8 handling, and then puts the lower lever things in the
switch().  Perhaps the C optimizer will be smart enough to do this too,
but we might as well do it ourselves, now that it is convenient.


  Commit: d85a30b0b2e79aabe1d5747fcdd72dd215f3512c
      https://github.com/Perl/perl5/commit/d85a30b0b2e79aabe1d5747fcdd72dd215f3512c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M regexec.c

  Log Message:
  -----------
  regexec.c: Refactor switch default()

It seems clearer to me to have the panic at the end of the routine
instead of as the default: of a switch().


  Commit: c2c69d133c8c8718e496bbbc1049ae6a4da68de1
      https://github.com/Perl/perl5/commit/c2c69d133c8c8718e496bbbc1049ae6a4da68de1
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Declare three static arrays to be so.


  Commit: e0d3678a9369249d8a7382b898bfa64ef9301405
      https://github.com/Perl/perl5/commit/e0d3678a9369249d8a7382b898bfa64ef9301405
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 366a23e5f84d6f0130a0f4b7aa643be32c4fefe8
      https://github.com/Perl/perl5/commit/366a23e5f84d6f0130a0f4b7aa643be32c4fefe8
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: e991f96df3e868833b726ad336b7182bc1a8431e
      https://github.com/Perl/perl5/commit/e991f96df3e868833b726ad336b7182bc1a8431e
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: fdcf08b75e9c99970a8d6da429845346f9266321
      https://github.com/Perl/perl5/commit/fdcf08b75e9c99970a8d6da429845346f9266321
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 44d79f74cf55f270a51b183a6e7292acd2029740
      https://github.com/Perl/perl5/commit/44d79f74cf55f270a51b183a6e7292acd2029740
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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() is the base
level.


  Commit: ff782b4ff57a894edde592c0c5af5d44df0b93b0
      https://github.com/Perl/perl5/commit/ff782b4ff57a894edde592c0c5af5d44df0b93b0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 01696a58ef1cceb93a33f3b8926385fc8b745166
      https://github.com/Perl/perl5/commit/01696a58ef1cceb93a33f3b8926385fc8b745166
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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 edges of the locale-handling code; once found the index is used in
future bits of the current operation.


  Commit: 1ce1ea2176dd5872f9938bef5d070a02675b3d2b
      https://github.com/Perl/perl5/commit/1ce1ea2176dd5872f9938bef5d070a02675b3d2b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: f236fa930964a975e5eb4e37094b8a5c61734b0a
      https://github.com/Perl/perl5/commit/f236fa930964a975e5eb4e37094b8a5c61734b0a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 19173ecdb6f80e6e168180ee6d5b0d0b77812f20
      https://github.com/Perl/perl5/commit/19173ecdb6f80e6e168180ee6d5b0d0b77812f20
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: f3e66fd4f8d3acc2a267d0adf7d75f074216cd3a
      https://github.com/Perl/perl5/commit/f3e66fd4f8d3acc2a267d0adf7d75f074216cd3a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: b8ce202bb89d5d12ad5038686ab30042f9167b23
      https://github.com/Perl/perl5/commit/b8ce202bb89d5d12ad5038686ab30042f9167b23
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 716fa1cbd69095eb8d68ebe220d93bfb43802c67
      https://github.com/Perl/perl5/commit/716fa1cbd69095eb8d68ebe220d93bfb43802c67
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Move fcn within file

This is for later commits which will change it to rely on new defines
that won't occur until later in the file than its current position


  Commit: df01cc6ef266bfe7f814fac51f925cbebc993f6b
      https://github.com/Perl/perl5/commit/df01cc6ef266bfe7f814fac51f925cbebc993f6b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: a4c7529bc767b1981e4a1725950bc3c214413ab8
      https://github.com/Perl/perl5/commit/a4c7529bc767b1981e4a1725950bc3c214413ab8
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Outdent previous commit

The previous commit kept the indentation level the same as it moved code
to a new function, even though an outer block was stripped off in the
process.  This was to minimize diff output.  This commit is white space
only.


  Commit: eff9f0b608c1ac1c507db8574dcacb8df8f27244
      https://github.com/Perl/perl5/commit/eff9f0b608c1ac1c507db8574dcacb8df8f27244
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: ea14121517b70162295813d2c5a57246d8e76e15
      https://github.com/Perl/perl5/commit/ea14121517b70162295813d2c5a57246d8e76e15
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: ccfb0257995ec0a06b4c584f1feac4a9da494867
      https://github.com/Perl/perl5/commit/ccfb0257995ec0a06b4c584f1feac4a9da494867
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 5d6cacb46a2ea95eeb956f836d1020d91c2a6c42
      https://github.com/Perl/perl5/commit/5d6cacb46a2ea95eeb956f836d1020d91c2a6c42
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: f596e245088a162066199500c33cc7b7e3390d78
      https://github.com/Perl/perl5/commit/f596e245088a162066199500c33cc7b7e3390d78
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 335ec51fef00ce6763d61d484575a2a070d009ec
      https://github.com/Perl/perl5/commit/335ec51fef00ce6763d61d484575a2a070d009ec
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 15ff611b3c684332bd1f56dddcdbe81ed7f5ba86
      https://github.com/Perl/perl5/commit/15ff611b3c684332bd1f56dddcdbe81ed7f5ba86
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 97b10e3bf51514aafa58bfb7122af59603b6670b
      https://github.com/Perl/perl5/commit/97b10e3bf51514aafa58bfb7122af59603b6670b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 9532cf2fe53664b66459c06db3bf912ee420f270
      https://github.com/Perl/perl5/commit/9532cf2fe53664b66459c06db3bf912ee420f270
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 5f481764066dd8045e9a16a5bcb11601261da294
      https://github.com/Perl/perl5/commit/5f481764066dd8045e9a16a5bcb11601261da294
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: c59b962aa0a7c4c56e56ad5e158de73d6160b011
      https://github.com/Perl/perl5/commit/c59b962aa0a7c4c56e56ad5e158de73d6160b011
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: f332e7c83ab5991b5da62255fd8ebbb5042272e8
      https://github.com/Perl/perl5/commit/f332e7c83ab5991b5da62255fd8ebbb5042272e8
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Expand scope of cpp conditional

This just doesn't bother with checking some locale-related stuff if not
paying attention to locales.


  Commit: 636caaeedb21916dddc1eb4de8044a5f9b5c22ff
      https://github.com/Perl/perl5/commit/636caaeedb21916dddc1eb4de8044a5f9b5c22ff
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c
    M perl.h

  Log Message:
  -----------
  locale.c: Create new convenience macro

glibc doesn't have the querylocale() function, available on some other
platforms, such as Darwin and *BSD.  However, it instead has the
equivalent functionality available through an undocumented feature.

This commit allows someone in the know to compile perl to use that
feature, and wraps its API with a macro so that the calling code doesn't
have to be aware of the different APIs of the two methods.

That macro's definition is now done in perl.h, as future commits will
use it in other files.

Since this is an undocumented feature, I am not currently documenting
this wrapper availability.  However, it has been used in the field
without complaint for a couple of releases, as follows:  A more
cumbersome substitute method continues to be used to get what it does.
But in the past both methods were tried and the program died if they
yielded different results.  Since no one has complained, I'm fairly
confident it works.  But sill I'm deferring its more general use.


  Commit: ac9072eeae931c67aeee0bcbe58ed2878bdab4f1
      https://github.com/Perl/perl5/commit/ac9072eeae931c67aeee0bcbe58ed2878bdab4f1
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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.  As part of this commit, constness is added to PL_curlocales[]

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: ce3ad3b749f2827032c44d8d309610b1b140dde8
      https://github.com/Perl/perl5/commit/ce3ad3b749f2827032c44d8d309610b1b140dde8
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M intrpvar.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  Make three locale PL_ strings const char*

This adds some compile safety to these.


  Commit: a687f494cc22bbbe0b43bb0c4508b53d94940b0a
      https://github.com/Perl/perl5/commit/a687f494cc22bbbe0b43bb0c4508b53d94940b0a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Generalize stdsize_locale()

This function is rewritten to handle LC_ALL, and to handle certain buggy
Win32 locale names.  This commit also calls it in appropriate places
where those buggy names could be returned.

setlocale() on Windows may return a locale that cannot be used as input
to a future setlocale().  This is contrary to the C89 standard, and
appears to have been an oversight corrected in the most recent Windows
version(s).

This commit solves the problem (as far as I know) by looking for the
problematic syntax and adjusting it.

I also rewrote the function to handle LC_ALL, which fixes that deficiency.

And, a change in that that I think is an improvement is that everything
starting with a \n is trimmed, instead of just a trailing \n being
chomped.


  Commit: dc54e3272cb40ccc83269ed11db708127558cda6
      https://github.com/Perl/perl5/commit/dc54e3272cb40ccc83269ed11db708127558cda6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  XXX drop stdize_locale: #if 0, enabled even for emulate


  Commit: 13adca26df632d752e088e5eecf3370283818f75
      https://github.com/Perl/perl5/commit/13adca26df632d752e088e5eecf3370283818f75
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  XXX debug stdized


  Commit: 889add25416ecceaa9edcf7bb3aab7710330bbe3
      https://github.com/Perl/perl5/commit/889add25416ecceaa9edcf7bb3aab7710330bbe3
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Refactor some derived #defines

The _c suffix is supposed to mean the category is known at compile time.
In some configurations this does not matter, and so I had named things
carelessly, so this might be confusing.  This commit fixes that.


  Commit: 5de7377e97f81bb3eaf44b77072ad2ad6a26466a
      https://github.com/Perl/perl5/commit/5de7377e97f81bb3eaf44b77072ad2ad6a26466a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: d9cf7798d1ec5ef524929d1ec26ed2d349231b07
      https://github.com/Perl/perl5/commit/d9cf7798d1ec5ef524929d1ec26ed2d349231b07
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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 is being 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: 4b513f2b070c531f5701fab4e2695b8d19f9d469
      https://github.com/Perl/perl5/commit/4b513f2b070c531f5701fab4e2695b8d19f9d469
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: bb75112a39df2bd403d042f52b799e99a69e6cbb
      https://github.com/Perl/perl5/commit/bb75112a39df2bd403d042f52b799e99a69e6cbb
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: be72d7cca1daee647b677364152db85ca46af5c2
      https://github.com/Perl/perl5/commit/be72d7cca1daee647b677364152db85ca46af5c2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: eafbaeac8f2716bd15cdf76eb7ae13c6c6da23c6
      https://github.com/Perl/perl5/commit/eafbaeac8f2716bd15cdf76eb7ae13c6c6da23c6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 3c0b5d2ddadb2e3fabd12759bdb30a601639fca6
      https://github.com/Perl/perl5/commit/3c0b5d2ddadb2e3fabd12759bdb30a601639fca6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: eeea507553583a449b26d8dae71b03c0e9c31755
      https://github.com/Perl/perl5/commit/eeea507553583a449b26d8dae71b03c0e9c31755
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 040f2d8575764285b890e7bb654975342503924c
      https://github.com/Perl/perl5/commit/040f2d8575764285b890e7bb654975342503924c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 46d54146011110d86f8f0d3654760f93674b131c
      https://github.com/Perl/perl5/commit/46d54146011110d86f8f0d3654760f93674b131c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: a8febb40f14d7a8a49e1ca09923ee33d733a00eb
      https://github.com/Perl/perl5/commit/a8febb40f14d7a8a49e1ca09923ee33d733a00eb
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 198bf9d863342650b422bea3c08987acc065bbc2
      https://github.com/Perl/perl5/commit/198bf9d863342650b422bea3c08987acc065bbc2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: b4264e50c1f0dfc978f9c4a71fb81964f8b73d65
      https://github.com/Perl/perl5/commit/b4264e50c1f0dfc978f9c4a71fb81964f8b73d65
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M ext/POSIX/POSIX.xs

  Log Message:
  -----------
  POSIX.xs: White-space only

Properly indent some nested preprocessor directives


  Commit: 92639a15a4f2bcfae0ebe70193e9cfbe7780fcc2
      https://github.com/Perl/perl5/commit/92639a15a4f2bcfae0ebe70193e9cfbe7780fcc2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 0997a25d3ec84cf4f599e909a6a06857ccd1998f
      https://github.com/Perl/perl5/commit/0997a25d3ec84cf4f599e909a6a06857ccd1998f
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: dac08a83de669587ed4944a84e4c7b07ee1e7297
      https://github.com/Perl/perl5/commit/dac08a83de669587ed4944a84e4c7b07ee1e7297
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: f6b065e087a18c6d96e695c7e1a895da6ddf06c2
      https://github.com/Perl/perl5/commit/f6b065e087a18c6d96e695c7e1a895da6ddf06c2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: a7fa1933b9b8b4690c6755169820dab051155ce8
      https://github.com/Perl/perl5/commit/a7fa1933b9b8b4690c6755169820dab051155ce8
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 293d7bff5419b6a73a2feee0b805a8e39ddbfd16
      https://github.com/Perl/perl5/commit/293d7bff5419b6a73a2feee0b805a8e39ddbfd16
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 35f32621a60a44b4f86e0b26f5c621f203be3b96
      https://github.com/Perl/perl5/commit/35f32621a60a44b4f86e0b26f5c621f203be3b96
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: a0d02e942165dde9a537c9abd843025ef01b2583
      https://github.com/Perl/perl5/commit/a0d02e942165dde9a537c9abd843025ef01b2583
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 00ff4f36481bd3bb134e255d27eb68e21eb8c27d
      https://github.com/Perl/perl5/commit/00ff4f36481bd3bb134e255d27eb68e21eb8c27d
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use typedef to simplify

This allows some preprocessor conditionals to be removed


  Commit: 63597be5ffd62d2907a0169f0bd0576f006c2751
      https://github.com/Perl/perl5/commit/63597be5ffd62d2907a0169f0bd0576f006c2751
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Rmv redundant cBOOL()

strEQ and && already return booleans


  Commit: bba0e8af36c3f63279bbc7e6c0f537bcc29bd961
      https://github.com/Perl/perl5/commit/bba0e8af36c3f63279bbc7e6c0f537bcc29bd961
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 9770d78d3106b4bc2f6786cca9f077a49fd8ffd7
      https://github.com/Perl/perl5/commit/9770d78d3106b4bc2f6786cca9f077a49fd8ffd7
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: ce44b3ac5daaf29f57767ec623fefe4f016bfb28
      https://github.com/Perl/perl5/commit/ce44b3ac5daaf29f57767ec623fefe4f016bfb28
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: a57ed3e5fbe4bc042af1720be05f27db06a3efb6
      https://github.com/Perl/perl5/commit/a57ed3e5fbe4bc042af1720be05f27db06a3efb6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 49ba798c8be7d28e12b528f8b17c1442203c6935
      https://github.com/Perl/perl5/commit/49ba798c8be7d28e12b528f8b17c1442203c6935
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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 that we aren't already in the desired locale before
changing locales. and does nothing if no change is needed.


  Commit: febd2e22d74bb5e67f8a6ddd3445798b6235bcd0
      https://github.com/Perl/perl5/commit/febd2e22d74bb5e67f8a6ddd3445798b6235bcd0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use a scratch buf; instead of reusing old

This is in preparation for the next commit


  Commit: f7b61cb695b46acd5e0bda627ef176a93d114ec9
      https://github.com/Perl/perl5/commit/f7b61cb695b46acd5e0bda627ef176a93d114ec9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 25aff709176461a9423db822aed0c9ab70b23a15
      https://github.com/Perl/perl5/commit/25aff709176461a9423db822aed0c9ab70b23a15
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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.


  Commit: af72a70df484c5130e5acc0ef8ab580963c6c4e0
      https://github.com/Perl/perl5/commit/af72a70df484c5130e5acc0ef8ab580963c6c4e0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: ce95d4586c52031a17d5bd5e11e4d83ca9d64dad
      https://github.com/Perl/perl5/commit/ce95d4586c52031a17d5bd5e11e4d83ca9d64dad
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 9d160092653eef6b467c26b44b1388faf8ad05cf
      https://github.com/Perl/perl5/commit/9d160092653eef6b467c26b44b1388faf8ad05cf
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 2009b472805269d21c356b99e92eab3563be33ae
      https://github.com/Perl/perl5/commit/2009b472805269d21c356b99e92eab3563be33ae
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 8f96c74851f12c476d866fff1687ff082c484968
      https://github.com/Perl/perl5/commit/8f96c74851f12c476d866fff1687ff082c484968
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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_i() will determine if the string it is passed
in the locale it is passed is to be treated as UTF-8, or not.


  Commit: 456c5d564f106c70e5d6e8ccd815d8c01921382e
      https://github.com/Perl/perl5/commit/456c5d564f106c70e5d6e8ccd815d8c01921382e
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 3f3b5227096f9de608ea9fc3607d0f40751f2f3c
      https://github.com/Perl/perl5/commit/3f3b5227096f9de608ea9fc3607d0f40751f2f3c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: ccf23fc10d9db333bc2452c85196a25d352f8a95
      https://github.com/Perl/perl5/commit/ccf23fc10d9db333bc2452c85196a25d352f8a95
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 5693811e5c100f7c1a57d9a7cbbde87bfe316bc8
      https://github.com/Perl/perl5/commit/5693811e5c100f7c1a57d9a7cbbde87bfe316bc8
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 05ff9d4c5c3fe31382fd5ab6c2e9121e32683674
      https://github.com/Perl/perl5/commit/05ff9d4c5c3fe31382fd5ab6c2e9121e32683674
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 2a2cffc0965f5d34bda7ad79c1d744488aa32872
      https://github.com/Perl/perl5/commit/2a2cffc0965f5d34bda7ad79c1d744488aa32872
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: c005b1b85cf1a7f6c569fef85b2f16de9bcde8a2
      https://github.com/Perl/perl5/commit/c005b1b85cf1a7f6c569fef85b2f16de9bcde8a2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 264e217feebf026fe3befe78c8f51d8307d47cf7
      https://github.com/Perl/perl5/commit/264e217feebf026fe3befe78c8f51d8307d47cf7
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use Strerror(), not strerror()


  Commit: 8275e6e3efbf57a79cf87613a98fa60bf75e8f7c
      https://github.com/Perl/perl5/commit/8275e6e3efbf57a79cf87613a98fa60bf75e8f7c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 3175c0fae973e457ac4a63a56e9f6abb1bf3e95d
      https://github.com/Perl/perl5/commit/3175c0fae973e457ac4a63a56e9f6abb1bf3e95d
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 06730bc04835598a8e59cc575ce52ffda75615aa
      https://github.com/Perl/perl5/commit/06730bc04835598a8e59cc575ce52ffda75615aa
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M makedef.pl
    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: 4efd0ba6fe50db502a865785ccd500619ceb12cb
      https://github.com/Perl/perl5/commit/4efd0ba6fe50db502a865785ccd500619ceb12cb
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M mg.c

  Log Message:
  -----------
  mg.c: White-space only

Indent newly formed block from the previous commit.


  Commit: 48d4958334ab44930ed415cb696f1945664f6703
      https://github.com/Perl/perl5/commit/48d4958334ab44930ed415cb696f1945664f6703
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 089020e92e3f3be8ecd8983b88339b89eeafaf73
      https://github.com/Perl/perl5/commit/089020e92e3f3be8ecd8983b88339b89eeafaf73
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 43b999ba0513c84b0639a5106fad4ed860711e82
      https://github.com/Perl/perl5/commit/43b999ba0513c84b0639a5106fad4ed860711e82
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M perl.h
    M proto.h

  Log Message:
  -----------
  Add a common locale panic macro and functions

This will make sure that all the necessary clean up gets done.


  Commit: d1ab98b30dc917ae568c8fec1873bf89058dadc6
      https://github.com/Perl/perl5/commit/d1ab98b30dc917ae568c8fec1873bf89058dadc6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: fddc61e3f19d39bd648872ade02ef6d85b77aa28
      https://github.com/Perl/perl5/commit/fddc61e3f19d39bd648872ade02ef6d85b77aa28
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: f925b1ad1e397f4be9371117830c71518414de46
      https://github.com/Perl/perl5/commit/f925b1ad1e397f4be9371117830c71518414de46
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: ec9977ad82b7175fa5f65172dc0d93fb20ce2ded
      https://github.com/Perl/perl5/commit/ec9977ad82b7175fa5f65172dc0d93fb20ce2ded
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 8f1844d80d05b4e41ed330fd4f7871e440cf31f3
      https://github.com/Perl/perl5/commit/8f1844d80d05b4e41ed330fd4f7871e440cf31f3
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 3c4e5af1a391b84c823bd563ae471d080bade031
      https://github.com/Perl/perl5/commit/3c4e5af1a391b84c823bd563ae471d080bade031
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 390640b3e97d6c4682a0cf982a1d37ac18a0c938
      https://github.com/Perl/perl5/commit/390640b3e97d6c4682a0cf982a1d37ac18a0c938
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 2acb7bfef10df6214cd7d51c95b5cce6ca792adb
      https://github.com/Perl/perl5/commit/2acb7bfef10df6214cd7d51c95b5cce6ca792adb
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 2c5405ff97991d96dad6134358a94ee0b39bf511
      https://github.com/Perl/perl5/commit/2c5405ff97991d96dad6134358a94ee0b39bf511
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  XXX PORCELAIN_SET not yet defined 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: b6e4fb105a07ed23db35b0f66be9b51627c27d0d
      https://github.com/Perl/perl5/commit/b6e4fb105a07ed23db35b0f66be9b51627c27d0d
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add some asserts


  Commit: eb5c247b26247f65fa9f93e7f765f058715e17c2
      https://github.com/Perl/perl5/commit/eb5c247b26247f65fa9f93e7f765f058715e17c2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: 49b5f49156a63fa9e4b648a0a5dd677559bbd0c0
      https://github.com/Perl/perl5/commit/49b5f49156a63fa9e4b648a0a5dd677559bbd0c0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: f9b782624af66e11782e917738789e263f2577ec
      https://github.com/Perl/perl5/commit/f9b782624af66e11782e917738789e263f2577ec
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 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: f9986eff2fe481cb91ca67763056ea56548d984d
      https://github.com/Perl/perl5/commit/f9986eff2fe481cb91ca67763056ea56548d984d
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Change assert() into STATIC_ASSERT()


  Commit: 31543999b94710537bd9e1787b06ebf412f236e1
      https://github.com/Perl/perl5/commit/31543999b94710537bd9e1787b06ebf412f236e1
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use standard fold table for C locale

Copy the standard compiled-in ASCII fold table when the locale is C or
POSIX, instead of looping through all 256 characters and computing them.
This saves some time as well as ensures that any platform bugs become
irrelevant.


  Commit: 010d4fc32b4b7398083fa0b15e93823aa326a7e8
      https://github.com/Perl/perl5/commit/010d4fc32b4b7398083fa0b15e93823aa326a7e8
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add check that strxfrm didn't fail

The code failed to take into account that strxfrm() can fail for reasons
besides buffer length.  It does not return errors, and the only way to
check is to set errno to 0 beforehand, and check that it is still 0
afterwards.


  Commit: b376619fcca2e94c9ebecafb3ebf77bee95576e1
      https://github.com/Perl/perl5/commit/b376619fcca2e94c9ebecafb3ebf77bee95576e1
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Don't assume LC_CTYPE, LC_COLLATE are same

This code is using isCNTRL_LC which depends on LC_CTYPE to verify that
something in the LC_COLLATE locale is a control.  That only works
properly if the two locales are the same.  This commit adds code to
ensure they are.


  Commit: 41b83e12cc53e11a715f1b03ebe4ca6703fc2eff
      https://github.com/Perl/perl5/commit/41b83e12cc53e11a715f1b03ebe4ca6703fc2eff
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: strxfrm() requires LC_CTYPE eq LC_COLLATE

The libc functions strxfrm() on some platforms requires the LC_CTYPE
locale to be the same as the LC_COLLATE locale (or rather, probably that
they have the same code set, but checking for locale is cheaper).
Otherwise mojibake would result, or more likely the function will fail,
setting errno.

This commit brings the locales into alignment if necessary


  Commit: 0da8bbed56247500243961a11d7b4745fe35aab7
      https://github.com/Perl/perl5/commit/0da8bbed56247500243961a11d7b4745fe35aab7
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M Configure
    M Cross/config.sh-arm-linux
    M Cross/config.sh-arm-linux-n770
    M NetWare/config.wc
    M Porting/config.sh
    M config_h.SH
    M configure.com
    M metaconfig.h
    M plan9/config_sh.sample
    M uconfig.h
    M uconfig.sh
    M uconfig64.sh
    M win32/config.gc
    M win32/config.vc

  Log Message:
  -----------
  Configure: strxfrm_l


  Commit: da3f642bc3e6a51e4923c1fbc6a4330d6397a035
      https://github.com/Perl/perl5/commit/da3f642bc3e6a51e4923c1fbc6a4330d6397a035
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M lib/locale.t

  Log Message:
  -----------
  XXX temp: Windows debug


  Commit: 532c975df2493dbcad7f17fe37b8cca479768471
      https://github.com/Perl/perl5/commit/532c975df2493dbcad7f17fe37b8cca479768471
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use strxfrm_l() if available

This more modern version of the function doesn't require us to change
locales.


  Commit: a33fce0a03c16618bef15348021263c894356fe0
      https://github.com/Perl/perl5/commit/a33fce0a03c16618bef15348021263c894356fe0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M mathoms.c
    M proto.h
    M sv.c

  Log Message:
  -----------
  Change name of internal function

This is in preparation for working on it; the new name, mem_collxfrm_ is
in compliance with the C Standard; the old was not.


  Commit: 49e34392e89d6aef9d516f2ca425e9dbe45199a4
      https://github.com/Perl/perl5/commit/49e34392e89d6aef9d516f2ca425e9dbe45199a4
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M ext/POSIX/POSIX.xs
    M ext/POSIX/lib/POSIX.pod
    M locale.c
    M proto.h

  Log Message:
  -----------
  XXXdelta Fix POSIX::strxfrm()

This function takes an SV containing a PV.  The encoding of that PV is
based on the locale of the LC_CTYPE locale.  It really doesn't make
sense to collate based off of the sequencing of a different locale, which
prior to this commit it would do if the LC_COLLATION locale were
different.


  Commit: f72f2e6db5709573bd70b0a724c5ee0d1c14e5c6
      https://github.com/Perl/perl5/commit/f72f2e6db5709573bd70b0a724c5ee0d1c14e5c6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Improve debugging for mem_collxfrm()

This prints out more information, better organized.

It also moves up the info from -DLv to plain -DL


  Commit: 89e39f96e35b861dfd448815f645ba3509cc7673
      https://github.com/Perl/perl5/commit/89e39f96e35b861dfd448815f645ba3509cc7673
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add debug statement for collation failure

Perhaps this should be a warning to the user that we couldn't calculate
collation info for the locale, but at least there should be a way to
get that info from a DEBUG statement


  Commit: c0a99e2959e5b825788ff4f806fc88c33ece87be
      https://github.com/Perl/perl5/commit/c0a99e2959e5b825788ff4f806fc88c33ece87be
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Print code point in hex, not decimal

Hex is the more familiar form


  Commit: ef22a0c798217b717411fbb1bbb2c682e102a556
      https://github.com/Perl/perl5/commit/ef22a0c798217b717411fbb1bbb2c682e102a556
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M ext/POSIX/POSIX.xs
    M locale.c
    M perl.h

  Log Message:
  -----------
  Mark certain mutex lock macros as private

mbtowc() mblen(), and wctomb() should not be directly used by XS
writers; instead use the POSIX versions.  Don't encourage the direct use
by having public macros to aid in their use.


  Commit: eb9e10c39f94b23745038d504902998d83a33341
      https://github.com/Perl/perl5/commit/eb9e10c39f94b23745038d504902998d83a33341
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Move some code around

This is purely to make future commits have smaller real difference
listings, and involves a temporary (complemented) copy of a preprocessor
conditional.


  Commit: 1707b2ca1fc64d17adf4904e4b7f10cdc6fd8f0f
      https://github.com/Perl/perl5/commit/1707b2ca1fc64d17adf4904e4b7f10cdc6fd8f0f
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Reorder cpp branches

Disposing of the trivial case first makes things easier to read.


  Commit: 694e063b79160166c011f27f3483bd03ce3209a9
      https://github.com/Perl/perl5/commit/694e063b79160166c011f27f3483bd03ce3209a9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embedvar.h
    M intrpvar.h
    M locale.c
    M makedef.pl
    M perl.h
    M sv.c

  Log Message:
  -----------
  Make the locale mutex a general semaphore

Future commits will use this new capability, and in Configurations where
no locale locking is currently necessary.


  Commit: e1918a2117bde335eb166537463a35d95ace10a0
      https://github.com/Perl/perl5/commit/e1918a2117bde335eb166537463a35d95ace10a0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embedvar.h
    M intrpvar.h
    M makedef.pl
    M perl.h
    M perlvars.h
    M sv.c

  Log Message:
  -----------
  Use general locale mutex for numeric operations

This commit removes the separate mutex for locking locale-related
numeric operations on threaded perls; instead using the general locale
one.  The previous commit made that a general semaphore, so now suitable
for use for this purpose as well.

This means that the locale can be locked for the duration of some
sprintf operations, longer than before this commit.  But on most modern
platforms, thread-safe locales cause this lock to expand just to a
no-op; so there is no effect on these.  And on the impacted platforms,
one is not supposed to be using locales and threads in combination, as
races can occur.  This lock is used on those perls to keep Perl's
manipulation of LC_NUMERIC thread-safe.  And for those there is also no
effect, as they already lock around those sprintf's.


  Commit: d4c7365ea8209c98127481b9027776fd2ee1d060
      https://github.com/Perl/perl5/commit/d4c7365ea8209c98127481b9027776fd2ee1d060
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  Add locale macro to wrap static-space-using fncs

Some functions return a result in a global-to-the-program buffer, or
they have an internal global buffer.  Other threads must be kept from
simultaneously using that function.  This macro is to be used for all
such ones dealing with locales.  Ideally, there would be a separate mutex
for each such buffer space.  But these functions also have to lock the
locale from changing during their execution, and there aren't that many
such functions, and they actually are rarely executed.  So a single lock
will do.

This will allow future commits to have more targeted locking for
functions that don't affect the global locale.


  Commit: 2b14c8e3529cdf9992c9c08f83489f83d80e6175
      https://github.com/Perl/perl5/commit/2b14c8e3529cdf9992c9c08f83489f83d80e6175
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  Redefine the POSIX.xs locale macros using prev commit

This commit uses the new macro introduced in the previous commit to
define the internal locale mutex macros in POSIX.xs


  Commit: 645314049ba4d1e4f84e16c308b58b6e111c78e7
      https://github.com/Perl/perl5/commit/645314049ba4d1e4f84e16c308b58b6e111c78e7
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c
    M perl.h

  Log Message:
  -----------
  perl.h: Remove NL_LANGINFO_LOCK

This is needed in precisely one place in the code, so move it to there.


  Commit: e942de97278806f7942464a9671869cb023f858c
      https://github.com/Perl/perl5/commit/e942de97278806f7942464a9671869cb023f858c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c
    M perl.h

  Log Message:
  -----------
  perl.h: Remove LOCALECONV_LOCK

This is needed in just one function, in locale.c, so more it there.


  Commit: 5a6abe411d07e8bb275123449f96862f6ebec991
      https://github.com/Perl/perl5/commit/5a6abe411d07e8bb275123449f96862f6ebec991
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c
    M perl.h

  Log Message:
  -----------
  XXX perlembed Add PORCELAIN_SETLOCALE_LOCK/UNLOCK

This macro is used to surround raw setlocale() calls so that the return
value in a global static buffer can be saved without interference with
other threads.

There are a few very rarely occurring instances in locale.c that are
converted to use this.  These previously could have been races.

The raw setlocales in the initialization function are not guarded, as
these happen early in the Perl process initialization, before threading
is enabled.

This is buggy if there are multiple embedded perls.  It can't be helped.
perlembed is being updated to indicate this.


  Commit: f8f014f15f0470c79654a3a6d6241c6f39849772
      https://github.com/Perl/perl5/commit/f8f014f15f0470c79654a3a6d6241c6f39849772
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Move #defining SETLOCALE_LOCK

This simplifies slightly, and will allow further simplification


  Commit: 584e30a8d6776f1800de14758d254e9b37a93806
      https://github.com/Perl/perl5/commit/584e30a8d6776f1800de14758d254e9b37a93806
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Move LOCALE_READ_LOCK #definition

To enable future simplifications


  Commit: 5963f55a803a5660df37bac8a14e3f1d76ea4708
      https://github.com/Perl/perl5/commit/5963f55a803a5660df37bac8a14e3f1d76ea4708
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M intrpvar.h
    M locale.c
    M makedef.pl
    M perl.c
    M perl.h
    M sv.c

  Log Message:
  -----------
  locale.c: Move #define to perl.h; use it elsewhere

 Rather than recalculate this combined conditional, do it once in
 perl.h.


  Commit: e3a16d3e034898ff5c91f1139eaf442243bb82c6
      https://github.com/Perl/perl5/commit/e3a16d3e034898ff5c91f1139eaf442243bb82c6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Mitigate unsafe threaded locales

This a new set of macros and functions to do locale changing and
querying for platforms where perl is compiled with threads, but the
platform doesn't have thread-safe locale handling.

All it does is:

1) The return of setlocale() is always safely saved in a per-thread
buffer, and
2) setlocale() is protected by a mutex from other threads which are
using perl's locale functions.

This isn't much, but it might be enough to get some programs to work on
such platforms which rarely change or query the locale.


  Commit: aac92f194556056366b23da7e40785e20c0f6256
      https://github.com/Perl/perl5/commit/aac92f194556056366b23da7e40785e20c0f6256
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  XXX make sure comments get moved appropriately perl.h: Remove now empty block

Previous commits have left this empty except for comments.


  Commit: 6dd85fd61f8f4cf6debbf0f53a83f649fcc9782a
      https://github.com/Perl/perl5/commit/6dd85fd61f8f4cf6debbf0f53a83f649fcc9782a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M pp.c

  Log Message:
  -----------
  XXX pp.c: do %g print under mutex,


  Commit: c90f8be685a304183d5459fa90f30f6fd0584609
      https://github.com/Perl/perl5/commit/c90f8be685a304183d5459fa90f30f6fd0584609
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M ebcdic_tables.h
    M embedvar.h
    M globvar.sym
    M inline.h
    M intrpvar.h
    M perl.h
    M regen/ebcdic.pl
    M sv.c

  Log Message:
  -----------
  Make fc(), /i thread-safe on participating platforms

A long standing bug in Perl that has gone undetected is that the array
is global that is created when changing locales and tells fc() and qr//i
matching what the folds are in the new locale.

What this means is that any program only has one set of fold definitions
that apply to all threads within it, even if we claim that the locales
are thread-safe on the given platform.  One possibility for this going
undetected so long is that no one is using locales on multi-threaded
systems much.  Another possibility is that modern UTF-8 locales have the
same set of folds as any other one.

It is a simple matter to make the fold array per-thread instead of
per-process, and that solves the problem transparently to other code.

I discovered this stress-testing locale handling under threads.  That
test will be added in a future commit.


  Commit: 9f032217b024b9da6412ff5e27c56995067e4265
      https://github.com/Perl/perl5/commit/9f032217b024b9da6412ff5e27c56995067e4265
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M inline.h
    M locale.c

  Log Message:
  -----------
  XXX temp debug? locale.c, inline.h:foldEQ_locale


  Commit: 7c3c1d445ef18c50a42ab7394de9deb872afd8dd
      https://github.com/Perl/perl5/commit/7c3c1d445ef18c50a42ab7394de9deb872afd8dd
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c comments


  Commit: 900a70e536117e50870636f334d40eccb7fb177f
      https://github.com/Perl/perl5/commit/900a70e536117e50870636f334d40eccb7fb177f
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  XXX prob drop; done before anything so no races


  Commit: 8fa705295d2138e1b8fdb8de6229e09f3f7c2e84
      https://github.com/Perl/perl5/commit/8fa705295d2138e1b8fdb8de6229e09f3f7c2e84
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Add #define for gwENVr_LOCALEr_UNLOCK

This is for functions that read the locale and environment and write to
some global space.


  Commit: 63133a38004742b3a07b86b34b643380e754fc06
      https://github.com/Perl/perl5/commit/63133a38004742b3a07b86b34b643380e754fc06
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h
    M time64.c

  Log Message:
  -----------
  Remove ENV_LOCALE_LOCK/UNLOCK macros

These are subsumed by gwENVr_LOCALEr_LOCK created in the previous
commit.


  Commit: 3ff5df0bbadf793abcbd60c5885086a124c2b772
      https://github.com/Perl/perl5/commit/3ff5df0bbadf793abcbd60c5885086a124c2b772
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h
    M time64.c
    M util.c

  Log Message:
  -----------
  Change ENV/LOCALE locking read macro names

The old name was confusing.


  Commit: 4c51984db6e3a4d51df3bf80069f27dd48c0bf0e
      https://github.com/Perl/perl5/commit/4c51984db6e3a4d51df3bf80069f27dd48c0bf0e
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Move some statements

So they are closer to related statements


  Commit: c938217077d56a36dcded7dc232ade8e810077ed
      https://github.com/Perl/perl5/commit/c938217077d56a36dcded7dc232ade8e810077ed
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h
    M util.c

  Log Message:
  -----------
  perl.h: Finish implementing combo ENV/LOCALE mutexes

There are cases where an executing function is vulnerable to either the
locale or environment being changed by another thread.  This commit
implements macros that use mutexes to protect these critical sections.
There are two cases that exist:  one where the functions only read; and
one where they can also need exclusive control so that a competing
thread can't overwrite the returned static buffer before it is safely
copied.

5.32 had a placeholder for these, but didn't actually implement it.
Instead it locked just the ENV portion.  On modern platforms with
thread-safe locales, the locale portion is a no-op anyway, so things
worked on them.

This new commit extends that safety to other platforms.  This has long
been a vulnerability in Perl.


  Commit: f4ae671bfd60a7c54836b9071f8f23f07ad2207a
      https://github.com/Perl/perl5/commit/f4ae671bfd60a7c54836b9071f8f23f07ad2207a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M time64.c

  Log Message:
  -----------
  time64.c: Remove no longer needed code

This code defined some macros; those are now defined by perl.h


  Commit: ee5816dd4b75617506f038db21cd080b37245dbb
      https://github.com/Perl/perl5/commit/ee5816dd4b75617506f038db21cd080b37245dbb
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M pp_sys.c

  Log Message:
  -----------
  XXX need to StructCopy pp_sys mutexes


  Commit: 174c7ee229e4417011780ac7e006bb1c6a0a581a
      https://github.com/Perl/perl5/commit/174c7ee229e4417011780ac7e006bb1c6a0a581a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M win32/win32.c

  Log Message:
  -----------
  win32.c: Add mutexes around some calls

These could have races.


  Commit: ea80e29c84b0884de88423e75fa34cd36cc1dfbc
      https://github.com/Perl/perl5/commit/ea80e29c84b0884de88423e75fa34cd36cc1dfbc
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M ext/POSIX/POSIX.xs

  Log Message:
  -----------
  POSIX.xs env locks, check file for more


  Commit: cf9c0ef3fd9e5bd2d07c89546d29638dbec3f0fb
      https://github.com/Perl/perl5/commit/cf9c0ef3fd9e5bd2d07c89546d29638dbec3f0fb
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M util.c

  Log Message:
  -----------
  util.c: mktime needs to run under a mutex

per the Posix standard


  Commit: 6618ec01d60cd500198391063476648efa0a77de
      https://github.com/Perl/perl5/commit/6618ec01d60cd500198391063476648efa0a77de
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M util.c

  Log Message:
  -----------
  util.c: Add locks around strftime() calls


  Commit: 6dc6274bd83c124cb63f1e74c0155b5d7f20faa5
      https://github.com/Perl/perl5/commit/6dc6274bd83c124cb63f1e74c0155b5d7f20faa5
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M cygwin/cygwin.c

  Log Message:
  -----------
  cygwin


  Commit: 372f35e083b4cb7bc14018dcc6795b4ba5399ae0
      https://github.com/Perl/perl5/commit/372f35e083b4cb7bc14018dcc6795b4ba5399ae0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M os2/os2.c

  Log Message:
  -----------
  os2: Use many reader lock instead of exclusive

This is just reading the environment, not changing it, so a many readers
can be accessing it at the same time.


  Commit: fad0e1fe1a536702cbbf10e5190a782fd677ec52
      https://github.com/Perl/perl5/commit/fad0e1fe1a536702cbbf10e5190a782fd677ec52
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M cpan/Time-Piece/Piece.pm
    M cpan/Time-Piece/Piece.xs

  Log Message:
  -----------
  XXX cpan PR Time-Piece: Add locks

This add mutex locking around some unsafe thread operations to make this
module thread-safe.


  Commit: a995ae644b257d97f65eca7dcf733b74e617d2d9
      https://github.com/Perl/perl5/commit/a995ae644b257d97f65eca7dcf733b74e617d2d9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M cpan/Time-Piece/Piece.xs

  Log Message:
  -----------
  Time-Piece: Use foldEQ_locale() if available

This supported core function is thread-safe and knows about Perl
internals, so is preferable to the similar libc function, which is now
used only as a fallback.  This commit also bomb proofs the code by
adding an additional fallback, specified in C89, which isn't a great
substituted, but far better than nothing.


  Commit: fd4e7cc1faa70142b53170253d588cf70106cb79
      https://github.com/Perl/perl5/commit/fd4e7cc1faa70142b53170253d588cf70106cb79
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M cpan/Time-Piece/Piece.xs

  Log Message:
  -----------
  Time-Piece: Use isSPACE, not isspace

The latter gives results that are dependent on the program's underlying
locale, and so may be inconsistent.

If locale dependence is actually desired, isSPACE_LC should be used, as
it knows about various things the module writer shouldn't have to
concern themselves with.  It is supported since 5.004


  Commit: 2b611cc9bd7343f0aae8dccb9ad702120b522cba
      https://github.com/Perl/perl5/commit/2b611cc9bd7343f0aae8dccb9ad702120b522cba
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M cpan/Time-Piece/Piece.xs

  Log Message:
  -----------
  Time-Piece: Use isDIGIT, not isdigit

The latter gives results that are dependent on the program's underlying
locale, and so may be inconsistent.

If locale dependence is actually desired, isDIGIT_LC should be used, as
it knows about various things the module writer shouldn't have to
concern themselves with.  It is supported since 5.004


  Commit: b44be40dd65d0d0ba51ad9906a85cf7bda188a3c
      https://github.com/Perl/perl5/commit/b44be40dd65d0d0ba51ad9906a85cf7bda188a3c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M cpan/Time-Piece/Piece.xs

  Log Message:
  -----------
  Time-Piece: Use isUPPER, not isupper

The latter gives results that are dependent on the program's underlying
locale, and so may be inconsistent.

If locale dependence is actually desired, isUPPER_LC should be used, as
it knows about various things the module writer shouldn't have to
concern themselves with.  It is supported since 5.004


  Commit: b3dab3c0591ba1a395432b50d104b280325acd2a
      https://github.com/Perl/perl5/commit/b3dab3c0591ba1a395432b50d104b280325acd2a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M pod/perlhacktips.pod

  Log Message:
  -----------
  XXX incomplete perlhacktips:


  Commit: faecd9c3ba0eeddbb1ae7a3ebd2cbd3357d5b91e
      https://github.com/Perl/perl5/commit/faecd9c3ba0eeddbb1ae7a3ebd2cbd3357d5b91e
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M dist/IO/IO.pm
    M dist/IO/IO.xs

  Log Message:
  -----------
  XXX check if using ppport IO.xs: Remove fallback code furnished by ppport


  Commit: 1d1866548d8f1f523251d9078fe59c3ec3f0f0c1
      https://github.com/Perl/perl5/commit/1d1866548d8f1f523251d9078fe59c3ec3f0f0c1
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M hints/freebsd.sh

  Log Message:
  -----------
  XXX check with freebsd: hints/freebsd.sh


  Commit: 91f594b7e78f7038c6a1143daabc928d5320671c
      https://github.com/Perl/perl5/commit/91f594b7e78f7038c6a1143daabc928d5320671c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M thread.h

  Log Message:
  -----------
  thread.h: White-space, braces only


  Commit: eba5ed44d0042138a3fc0a01d612b625ac689e9b
      https://github.com/Perl/perl5/commit/eba5ed44d0042138a3fc0a01d612b625ac689e9b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M thread.h

  Log Message:
  -----------
  XXX thread.h Save errno around lock/unlock


  Commit: 02260dd24252a872c714fe1b276d6d4263dbdb26
      https://github.com/Perl/perl5/commit/02260dd24252a872c714fe1b276d6d4263dbdb26
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  XXX perl.h: Debugging mutex lock'


  Commit: 0eb7fd72016f5d2101180e5f92ec873ddf5407ba
      https://github.com/Perl/perl5/commit/0eb7fd72016f5d2101180e5f92ec873ddf5407ba
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M cpan/Time-Piece/Piece.xs
    M handy.h
    M iperlsys.h
    M locale.c
    M perl.h
    M regen/reentr.pl
    M regexec.c
    M sv.c
    M util.c

  Log Message:
  -----------
  Notes


  Commit: 8c6dbeb1cae58357efd729262b115148c2a1ad87
      https://github.com/Perl/perl5/commit/8c6dbeb1cae58357efd729262b115148c2a1ad87
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M ext/POSIX/POSIX.xs
    M locale.c
    M perl.h

  Log Message:
  -----------
  locks


  Commit: 243b8a22837d4e6caecd848c4b604e81f20ea700
      https://github.com/Perl/perl5/commit/243b8a22837d4e6caecd848c4b604e81f20ea700
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  XXX locale.c: Kludge because C obj getting destroyed


  Commit: a137fb02e7507255f1cc7180f24e46e047a97616
      https://github.com/Perl/perl5/commit/a137fb02e7507255f1cc7180f24e46e047a97616
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M .github/workflows/testsuite.yml

  Log Message:
  -----------
  Make DEBUGGING the default on CI


  Commit: 7f1290da4b7d24cb19047f0f4c0a643fa7913524
      https://github.com/Perl/perl5/commit/7f1290da4b7d24cb19047f0f4c0a643fa7913524
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M t/run/locale.t

  Log Message:
  -----------
  t/run/locale.t


  Commit: a7314bea007fae65948055a58269551340282dc5
      https://github.com/Perl/perl5/commit/a7314bea007fae65948055a58269551340282dc5
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M t/run/locale.t

  Log Message:
  -----------
  t/run/locale.t: Move init stmt

This makes it easier to add a line to turn on debugging temporarily


  Commit: 5225bf321c84a0464c59b57480f96ea0cc0b89d8
      https://github.com/Perl/perl5/commit/5225bf321c84a0464c59b57480f96ea0cc0b89d8
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M t/run/locale.t

  Log Message:
  -----------
  XXX run/locale.t temp win


  Commit: 1e76600c7a68f4537d45afa6ad6080fba6e29bf0
      https://github.com/Perl/perl5/commit/1e76600c7a68f4537d45afa6ad6080fba6e29bf0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M t/porting/customized.dat
    M vutil.c

  Log Message:
  -----------
  vutil.c: Clean up white space

Change tabs to blanks; Fix indentation; chomp trailing white space

Remove some blank lines that don't contribute to readability


  Commit: 6dff814b7931a6ec11f856c7342ac3e2f6c5f493
      https://github.com/Perl/perl5/commit/6dff814b7931a6ec11f856c7342ac3e2f6c5f493
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M t/porting/customized.dat
    M vutil.c

  Log Message:
  -----------
  vutil.c: Simplify locale handling

I read the code over and realized that there was a much simpler way to
do things.


  Commit: 7c89928c081775f62dcca531d9fd10ef20696a73
      https://github.com/Perl/perl5/commit/7c89928c081775f62dcca531d9fd10ef20696a73
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Change a branch into an assert

This code should no longer be necessary; but verify


  Commit: ac7f7ee23433058c8b2080416b7a27b868722afd
      https://github.com/Perl/perl5/commit/ac7f7ee23433058c8b2080416b7a27b868722afd
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  XXX loc_tools: debug, white space


  Commit: bc3c5e3819cd274ee74c8e792a019464d29c1fcd
      https://github.com/Perl/perl5/commit/bc3c5e3819cd274ee74c8e792a019464d29c1fcd
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  Add pTHX to locale_thread_init()


  Commit: f4e23530328f7038bdbbbd90661c8516189af448
      https://github.com/Perl/perl5/commit/f4e23530328f7038bdbbbd90661c8516189af448
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  l


  Commit: 20f1ae850d55e81697a11a9ae2a207099e875649
      https://github.com/Perl/perl5/commit/20f1ae850d55e81697a11a9ae2a207099e875649
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embedvar.h
    M intrpvar.h
    M locale.c
    M sv.c

  Log Message:
  -----------
  PLcurlocales


  Commit: 83fecf6d389b533b140158168f87cb29556e2997
      https://github.com/Perl/perl5/commit/83fecf6d389b533b140158168f87cb29556e2997
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M lib/locale.t

  Log Message:
  -----------
  lib/locale.t FILE debug


  Commit: 3e09362bd982a2f736e2fd7d4232cc038bcf11d9
      https://github.com/Perl/perl5/commit/3e09362bd982a2f736e2fd7d4232cc038bcf11d9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: windows DEBUG stmts


  Commit: ad9cded6b2b6e8e2c6ba5d09fc47e3fdc85aa9fc
      https://github.com/Perl/perl5/commit/ad9cded6b2b6e8e2c6ba5d09fc47e3fdc85aa9fc
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M proto.h

  Log Message:
  -----------
  f save_to_buffer ignore return


  Commit: 25bb2c8ae9d102f4e38bbb910b7a97e23be0ee81
      https://github.com/Perl/perl5/commit/25bb2c8ae9d102f4e38bbb910b7a97e23be0ee81
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Add layer for char classification/case change

This layer currently expands to just the layer below it, but that will
be changed in a future commit.


  Commit: f7959f71878de1537dcd0a46f14aef18670d4946
      https://github.com/Perl/perl5/commit/f7959f71878de1537dcd0a46f14aef18670d4946
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/perlxs.pod
    M t/porting/known_pod_issues.dat

  Log Message:
  -----------
  perlxs


  Commit: b49dbe93a2bfa426586666846cf104db5e8c8a7d
      https://github.com/Perl/perl5/commit/b49dbe93a2bfa426586666846cf104db5e8c8a7d
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  XXX Temp dont use querylocale()


  Commit: dac5a04fb275c87645570cf796dc52e2cdea9c02
      https://github.com/Perl/perl5/commit/dac5a04fb275c87645570cf796dc52e2cdea9c02
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  l


  Commit: e15ced356f5f047f24bc8ec2603babbf5b8ced11
      https://github.com/Perl/perl5/commit/e15ced356f5f047f24bc8ec2603babbf5b8ced11
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embedvar.h
    M intrpvar.h
    M locale.c
    M sv.c

  Log Message:
  -----------
  Revert "PLcurlocales"

This reverts commit cd1fd76eac05b9ca866bb6f1dae6151767aa3d76.


  Commit: 6efbbb63fed65546df67facd95cecee6a1f9f42c
      https://github.com/Perl/perl5/commit/6efbbb63fed65546df67facd95cecee6a1f9f42c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Rmv unused code

The code to handle changing LC_COLLATION handled the possibility of
being passed a NULL locale name.  But we're not changing things unless
we have a new locale, and know its name.


  Commit: 31b94e1364aec9b61d80f445bab99e468d22e541
      https://github.com/Perl/perl5/commit/31b94e1364aec9b61d80f445bab99e468d22e541
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M intrpvar.h

  Log Message:
  -----------
  intrpvar.h: Swap position of two defns; add comment


  Commit: 3f752dcf523b1dbd43b74bc217169c2af1bd2327
      https://github.com/Perl/perl5/commit/3f752dcf523b1dbd43b74bc217169c2af1bd2327
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M intrpvar.h
    M locale.c

  Log Message:
  -----------
  locale.c: Add 'Lazy' location changing

When comparing two strings for order under 'use locale', one can call
strcoll() which creates hidden modified versions of the strings based on
the locale's collation ordering, does the comparison, and then throws
away the modified versions.

Or one can call strxfrm() to create a non-hidden modified version of
each string, and then do a straight comparison.  The advantage here is
that you are in control of when to discard the modified version, and the
(expensive) transformation is done just once, no matter how many times a
comparison is done.

Perl assumes that a string will be compared multiple times, so the first
time it happens under 'use locale', strxfrm() is called, and the
modified string is attached via magic to the SV.  The modified string is
discarded if the string changes, or is recomputed if the locale has
changed since the computation was done.

The transformation generally occupies some multiple of size of the
original string.  Memory must be allocated to hold it.  For any given
locale, the amount is predictable for all strings, roughly via a linear
equation "mx+b", where x is the size of the original string.  By
computing 'm' and 'b' once, Perl can allocate enough memory to hold the
transformation, but not too much.  (m and b are adjusted up as necessary
as more strings get transformed.)  This minimizes mallocs.

But the calculation of m and b is somewhat expensive, and only necessary
if the program actually does a string compare under 'use locale'.

This commit defers the calculation until needed.  It does the bare
minimum of changes accomplish this.  The next commit will rearrange
things.


  Commit: 64e90681852ca1613872881b7a4facb7d493e832
      https://github.com/Perl/perl5/commit/64e90681852ca1613872881b7a4facb7d493e832
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Move code, white-space, comment only

This moves the function created in the previous commit to a more logical
place in the file; just before its only call.  It also removes nested
blocks that are no longer necessary.


  Commit: 7829dcb0dfb7c44db22aa91dc0cabf095e50e4b3
      https://github.com/Perl/perl5/commit/7829dcb0dfb7c44db22aa91dc0cabf095e50e4b3
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M lib/locale_threads.t
    M locale.c

  Log Message:
  -----------
  f


  Commit: b0555eb0185de1206606b62a5752c7af19307219
      https://github.com/Perl/perl5/commit/b0555eb0185de1206606b62a5752c7af19307219
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M ext/XS-APItest/t/locale.t

  Log Message:
  -----------
  APItest/t/locale.t: Add missing SKIP: label


  Commit: ea7a1cc0642dc519e17bf6045258638051232ddf
      https://github.com/Perl/perl5/commit/ea7a1cc0642dc519e17bf6045258638051232ddf
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M ext/XS-APItest/t/locale.t

  Log Message:
  -----------
  APItest/t/locale.t: Fix tests

This was misleadingly outputting an undef value, instead of just saying
it's undef


  Commit: 2ea6fb1433bace17495e4370fc48e0d721eef371
      https://github.com/Perl/perl5/commit/2ea6fb1433bace17495e4370fc48e0d721eef371
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M embed.fnc
    M ext/XS-APItest/t/locale.t
    M lib/locale.t
    M lib/locale_threads.t
    M locale.c
    M proto.h

  Log Message:
  -----------
  f


Compare: https://github.com/Perl/perl5/compare/28b6e9990f00...2ea6fb1433ba



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About