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

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

From:
Karl Williamson via perl5-changes
Date:
March 31, 2021 03:53
Subject:
[Perl/perl5] 9a00c7: XXX craig Unixish.h, doshish.h: Reorderterminatio...
Message ID:
Perl/perl5/push/refs/heads/smoke-me/khw-locale/2ea6fb-4ca8ee@github.com
  Branch: refs/heads/smoke-me/khw-locale
  Home:   https://github.com/Perl/perl5
  Commit: 9a00c7f6f4b48ada7396396f73986a3da354f49e
      https://github.com/Perl/perl5/commit/9a00c7f6f4b48ada7396396f73986a3da354f49e
  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: b2f0cb16b16cc2a32039b95d5faf616feb0a442b
      https://github.com/Perl/perl5/commit/b2f0cb16b16cc2a32039b95d5faf616feb0a442b
  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: ceb46a6ec88dc8e67f3c8818271cde6d2d9adb17
      https://github.com/Perl/perl5/commit/ceb46a6ec88dc8e67f3c8818271cde6d2d9adb17
  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: 7e797fa87112eaa8d92685ceb5e73881ab73576c
      https://github.com/Perl/perl5/commit/7e797fa87112eaa8d92685ceb5e73881ab73576c
  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: ddfc3df09772a3cd0268e6d0ccbe96580f67c32f
      https://github.com/Perl/perl5/commit/ddfc3df09772a3cd0268e6d0ccbe96580f67c32f
  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: a7543e66b734d69985e22148dc63d0e8abab10c9
      https://github.com/Perl/perl5/commit/a7543e66b734d69985e22148dc63d0e8abab10c9
  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: a83e7a07865d687a952be6975d9786d6c0f22dd4
      https://github.com/Perl/perl5/commit/a83e7a07865d687a952be6975d9786d6c0f22dd4
  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: 0713974b00e19f67ea75130d59e69b45b2d523d1
      https://github.com/Perl/perl5/commit/0713974b00e19f67ea75130d59e69b45b2d523d1
  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: 228226b458ff10ddadd17f0d10ff726b325f6ae4
      https://github.com/Perl/perl5/commit/228226b458ff10ddadd17f0d10ff726b325f6ae4
  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: 96ca3311f490ebfe995c08e0904e47c1c0670898
      https://github.com/Perl/perl5/commit/96ca3311f490ebfe995c08e0904e47c1c0670898
  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: 6065f556a3903520f11272304c47fef467d3fe1e
      https://github.com/Perl/perl5/commit/6065f556a3903520f11272304c47fef467d3fe1e
  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: 45cf41e4c41c69251490b795e6b9b3bc75cdbf3f
      https://github.com/Perl/perl5/commit/45cf41e4c41c69251490b795e6b9b3bc75cdbf3f
  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: 1182a5c3883b1b74de472f3f673ee08b50272102
      https://github.com/Perl/perl5/commit/1182a5c3883b1b74de472f3f673ee08b50272102
  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: 67ecbd0265c0b31a62628bd72051aa27d9035190
      https://github.com/Perl/perl5/commit/67ecbd0265c0b31a62628bd72051aa27d9035190
  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: fecf9b2a1e7c2e1f37cd45fa79667e372cfa039a
      https://github.com/Perl/perl5/commit/fecf9b2a1e7c2e1f37cd45fa79667e372cfa039a
  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: 0dfdfc1269860ab98a8a578eef87e9c70f9ffdc5
      https://github.com/Perl/perl5/commit/0dfdfc1269860ab98a8a578eef87e9c70f9ffdc5
  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: aeb2e638cf7ee27d32e74201567933f422539179
      https://github.com/Perl/perl5/commit/aeb2e638cf7ee27d32e74201567933f422539179
  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: 68f644305416ad07e98a7b75d489555408ec2308
      https://github.com/Perl/perl5/commit/68f644305416ad07e98a7b75d489555408ec2308
  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: 432947625fbd31012b5f07d50217bd6337255582
      https://github.com/Perl/perl5/commit/432947625fbd31012b5f07d50217bd6337255582
  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: ef7533882c85ece7e9e72a91993c7c9f094312b3
      https://github.com/Perl/perl5/commit/ef7533882c85ece7e9e72a91993c7c9f094312b3
  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: 8dfa084f342cd7f8f2353f8fd1ea6ebd1fc44fab
      https://github.com/Perl/perl5/commit/8dfa084f342cd7f8f2353f8fd1ea6ebd1fc44fab
  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: b46f602486d91e96746577788704b04a55a63a8c
      https://github.com/Perl/perl5/commit/b46f602486d91e96746577788704b04a55a63a8c
  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: d5ec4670d84db48821eadbfd6b582fc8807ab87e
      https://github.com/Perl/perl5/commit/d5ec4670d84db48821eadbfd6b582fc8807ab87e
  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: 17863431c5588d6be9902b02c3e04b532c95eae4
      https://github.com/Perl/perl5/commit/17863431c5588d6be9902b02c3e04b532c95eae4
  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: a5749fd0a160536eb435bb0f95e535fe5254dc77
      https://github.com/Perl/perl5/commit/a5749fd0a160536eb435bb0f95e535fe5254dc77
  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: 0ddf72355d23f9d255aa54ebc827917c26667dc1
      https://github.com/Perl/perl5/commit/0ddf72355d23f9d255aa54ebc827917c26667dc1
  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: 8b519cf6335adddad7770d10dcb65b476be5ccda
      https://github.com/Perl/perl5/commit/8b519cf6335adddad7770d10dcb65b476be5ccda
  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: 2bcc6cce2c039bd1d5e3ed49f1f2fc8ffd64df8e
      https://github.com/Perl/perl5/commit/2bcc6cce2c039bd1d5e3ed49f1f2fc8ffd64df8e
  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: c01b6238767df64480ba2b91b9981b9a256021f4
      https://github.com/Perl/perl5/commit/c01b6238767df64480ba2b91b9981b9a256021f4
  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: 904f52876c54123fd385e6157a4a1b35d624e392
      https://github.com/Perl/perl5/commit/904f52876c54123fd385e6157a4a1b35d624e392
  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: 9b5fb895e1c422ea25eb540730b4a07826261f98
      https://github.com/Perl/perl5/commit/9b5fb895e1c422ea25eb540730b4a07826261f98
  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: f3ce84b8af5c837ca46b25a77db9f48c22afc4a0
      https://github.com/Perl/perl5/commit/f3ce84b8af5c837ca46b25a77db9f48c22afc4a0
  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: 2ea1a897d88fd9607e00521f6dc306e0a3e90595
      https://github.com/Perl/perl5/commit/2ea1a897d88fd9607e00521f6dc306e0a3e90595
  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: 84219197c5703042640269fd2030681febc9d436
      https://github.com/Perl/perl5/commit/84219197c5703042640269fd2030681febc9d436
  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: 668fe312d6b4271e9de3a2cc38eec5f13981fe06
      https://github.com/Perl/perl5/commit/668fe312d6b4271e9de3a2cc38eec5f13981fe06
  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: 6ed78e92694e3e11091ecd5d86d85e9a1b716c1b
      https://github.com/Perl/perl5/commit/6ed78e92694e3e11091ecd5d86d85e9a1b716c1b
  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: a0050431748c549c81242e7871fb6e0bf6caa569
      https://github.com/Perl/perl5/commit/a0050431748c549c81242e7871fb6e0bf6caa569
  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: bb79091665ba128b3e610eb8d50c78f30eac47a7
      https://github.com/Perl/perl5/commit/bb79091665ba128b3e610eb8d50c78f30eac47a7
  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: 0e719456c7e197cef1bb6c9271d7903566ed179f
      https://github.com/Perl/perl5/commit/0e719456c7e197cef1bb6c9271d7903566ed179f
  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: 32873ec73172cc282c06aef087b026ba81456986
      https://github.com/Perl/perl5/commit/32873ec73172cc282c06aef087b026ba81456986
  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: aa31b84f3ca8066a223e2f4651f310e4d9024b0d
      https://github.com/Perl/perl5/commit/aa31b84f3ca8066a223e2f4651f310e4d9024b0d
  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: 747c06d5f52237b8deb5fae56ebef7c79f4d4591
      https://github.com/Perl/perl5/commit/747c06d5f52237b8deb5fae56ebef7c79f4d4591
  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: 7eb98fd4b580d2253438a16fae4950a8b620cf9e
      https://github.com/Perl/perl5/commit/7eb98fd4b580d2253438a16fae4950a8b620cf9e
  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: 2f3bd0f1a30134429337c71dbb6e4748b6bd2ba9
      https://github.com/Perl/perl5/commit/2f3bd0f1a30134429337c71dbb6e4748b6bd2ba9
  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: ddecbf075a4c662aee6cae34cbb44783f2d544ac
      https://github.com/Perl/perl5/commit/ddecbf075a4c662aee6cae34cbb44783f2d544ac
  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: 913246b49c59973e83b65b2a0ed70a3e011517fb
      https://github.com/Perl/perl5/commit/913246b49c59973e83b65b2a0ed70a3e011517fb
  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: 07914571e82e60d40c9488260b2279292be95dee
      https://github.com/Perl/perl5/commit/07914571e82e60d40c9488260b2279292be95dee
  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: 809ce12fa0446e7bb40e592df9abc2bf681f41df
      https://github.com/Perl/perl5/commit/809ce12fa0446e7bb40e592df9abc2bf681f41df
  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: 3a15625d8438d35a60ba77c02d181af86b40bf31
      https://github.com/Perl/perl5/commit/3a15625d8438d35a60ba77c02d181af86b40bf31
  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: e292f66be642732000a6e1f512152bbb782c1ff9
      https://github.com/Perl/perl5/commit/e292f66be642732000a6e1f512152bbb782c1ff9
  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: 708770299a94fb169cbd9bd48ea42919167034ed
      https://github.com/Perl/perl5/commit/708770299a94fb169cbd9bd48ea42919167034ed
  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: 89ae7a9ecfc939869654bc71e73364e8eaa7e4c8
      https://github.com/Perl/perl5/commit/89ae7a9ecfc939869654bc71e73364e8eaa7e4c8
  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: 895a9b3bd5c427a70102f6aa40b5a5864f552718
      https://github.com/Perl/perl5/commit/895a9b3bd5c427a70102f6aa40b5a5864f552718
  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: cb39ad56706907abd60a605502b033ed73f88a32
      https://github.com/Perl/perl5/commit/cb39ad56706907abd60a605502b033ed73f88a32
  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: c748385d3fc78a98b3512ad0bf9554feb5ba4c8c
      https://github.com/Perl/perl5/commit/c748385d3fc78a98b3512ad0bf9554feb5ba4c8c
  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: 36f1e223d87fea39918dabb35b8d28cef05295d6
      https://github.com/Perl/perl5/commit/36f1e223d87fea39918dabb35b8d28cef05295d6
  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: 5e7d78a6d4eb82b20fa3710c105955674d34b7e3
      https://github.com/Perl/perl5/commit/5e7d78a6d4eb82b20fa3710c105955674d34b7e3
  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: b134fa2ee2a8f5470934a65728014f25e2931390
      https://github.com/Perl/perl5/commit/b134fa2ee2a8f5470934a65728014f25e2931390
  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: 94efc0e04d4fe020d0b267df88431dfc4138647f
      https://github.com/Perl/perl5/commit/94efc0e04d4fe020d0b267df88431dfc4138647f
  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: a2e2ca449e61c78d242203c07da04e4bc6dc9afe
      https://github.com/Perl/perl5/commit/a2e2ca449e61c78d242203c07da04e4bc6dc9afe
  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: 7a6329729673e67bdad197db1f3c1c3767ce2312
      https://github.com/Perl/perl5/commit/7a6329729673e67bdad197db1f3c1c3767ce2312
  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: 9be6fb79cd578c278f5226506fc14ed59871ef62
      https://github.com/Perl/perl5/commit/9be6fb79cd578c278f5226506fc14ed59871ef62
  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: ebfacfe3540f32a324573dbc6072df4ffa7338b9
      https://github.com/Perl/perl5/commit/ebfacfe3540f32a324573dbc6072df4ffa7338b9
  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: 15db2228e79cf5da6c7d0b81252e24d37a2ca7c5
      https://github.com/Perl/perl5/commit/15db2228e79cf5da6c7d0b81252e24d37a2ca7c5
  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: e5691f99e0a586d8fe7d1e4a0aa55143fe1822cc
      https://github.com/Perl/perl5/commit/e5691f99e0a586d8fe7d1e4a0aa55143fe1822cc
  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: a40079149e65a3b3bc16b22c693c97b502652ccd
      https://github.com/Perl/perl5/commit/a40079149e65a3b3bc16b22c693c97b502652ccd
  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: 901a1ecb49a939850e1aa470d5305d703839305a
      https://github.com/Perl/perl5/commit/901a1ecb49a939850e1aa470d5305d703839305a
  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: ea1e90cd566e54aab59ee98ed5c1d28a39b66d3b
      https://github.com/Perl/perl5/commit/ea1e90cd566e54aab59ee98ed5c1d28a39b66d3b
  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: 7616873aff5d5e38a9cdf3f0b14344dcfecd427d
      https://github.com/Perl/perl5/commit/7616873aff5d5e38a9cdf3f0b14344dcfecd427d
  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: 74b20e3b924649726c8f5409c6b6b250d2cd8ff5
      https://github.com/Perl/perl5/commit/74b20e3b924649726c8f5409c6b6b250d2cd8ff5
  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: 02ab254b90f0be9e2e1f0c5c28626886aed73dae
      https://github.com/Perl/perl5/commit/02ab254b90f0be9e2e1f0c5c28626886aed73dae
  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: 8280e5467a139b5b07121477d33661a08bd1374a
      https://github.com/Perl/perl5/commit/8280e5467a139b5b07121477d33661a08bd1374a
  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: 55b83ca48b4e4e065f40fc172c2a9341345943f9
      https://github.com/Perl/perl5/commit/55b83ca48b4e4e065f40fc172c2a9341345943f9
  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: 87435ec584ee41671cb5309a430a37a41d31c2e7
      https://github.com/Perl/perl5/commit/87435ec584ee41671cb5309a430a37a41d31c2e7
  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: e0d5e30febe2d63362feba1dbd1126a5478c0721
      https://github.com/Perl/perl5/commit/e0d5e30febe2d63362feba1dbd1126a5478c0721
  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: 91f9391dcfd8f3ca13f38af32c80166dc1b100bb
      https://github.com/Perl/perl5/commit/91f9391dcfd8f3ca13f38af32c80166dc1b100bb
  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: f5241520c8a8c00b5f825829d5ce171e91b52fe7
      https://github.com/Perl/perl5/commit/f5241520c8a8c00b5f825829d5ce171e91b52fe7
  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: e840d76d30c0600efdb2e0c7f43f86f7e03e89ab
      https://github.com/Perl/perl5/commit/e840d76d30c0600efdb2e0c7f43f86f7e03e89ab
  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: 9da803c28d7f248221ef5330ca3870fff0f33fc2
      https://github.com/Perl/perl5/commit/9da803c28d7f248221ef5330ca3870fff0f33fc2
  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: 80cb3e64baafdf418148e7b6f22bf24284ab325c
      https://github.com/Perl/perl5/commit/80cb3e64baafdf418148e7b6f22bf24284ab325c
  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: 6fb50f66399dd52c02f0be783581d51d349d167c
      https://github.com/Perl/perl5/commit/6fb50f66399dd52c02f0be783581d51d349d167c
  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: ce478ab096eb3ff7a5bf64c3de817ac7619f4ad0
      https://github.com/Perl/perl5/commit/ce478ab096eb3ff7a5bf64c3de817ac7619f4ad0
  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: 01d0623976394c4715c9191de687e4e2b83ffa4e
      https://github.com/Perl/perl5/commit/01d0623976394c4715c9191de687e4e2b83ffa4e
  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: a66d19cfd22c94a617738de403de64a579f0922f
      https://github.com/Perl/perl5/commit/a66d19cfd22c94a617738de403de64a579f0922f
  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: a85e4595909494c0ddb9e2be0423fc803e1ba58a
      https://github.com/Perl/perl5/commit/a85e4595909494c0ddb9e2be0423fc803e1ba58a
  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: 8a9a80ef4cf12abef6cf9db8eeebf6900e3b912e
      https://github.com/Perl/perl5/commit/8a9a80ef4cf12abef6cf9db8eeebf6900e3b912e
  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: 36d29e4ff4651bfa68ee5cbbf3b1870be5a2d227
      https://github.com/Perl/perl5/commit/36d29e4ff4651bfa68ee5cbbf3b1870be5a2d227
  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: 64e7c00bcf4b358f0c8227037da4d52eab5071dc
      https://github.com/Perl/perl5/commit/64e7c00bcf4b358f0c8227037da4d52eab5071dc
  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: 7e0e71fb00d255c9e2fd319c90e2ce5037e5e17e
      https://github.com/Perl/perl5/commit/7e0e71fb00d255c9e2fd319c90e2ce5037e5e17e
  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: c5df243f4175eaa6e896f539aa7e4f9268347300
      https://github.com/Perl/perl5/commit/c5df243f4175eaa6e896f539aa7e4f9268347300
  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: b6d0c33dcc3d9ce01de670549568e5f4470bb4e6
      https://github.com/Perl/perl5/commit/b6d0c33dcc3d9ce01de670549568e5f4470bb4e6
  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: d1a4c5477dbe8c1f2b117a45de9575f7201be6ba
      https://github.com/Perl/perl5/commit/d1a4c5477dbe8c1f2b117a45de9575f7201be6ba
  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: 3dce588780a9c7ce4dac7b4c398e9b0fbc72ac4f
      https://github.com/Perl/perl5/commit/3dce588780a9c7ce4dac7b4c398e9b0fbc72ac4f
  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: 0c42ac535238c7c4fd2e5ce5c7b73bdf6e81e6f3
      https://github.com/Perl/perl5/commit/0c42ac535238c7c4fd2e5ce5c7b73bdf6e81e6f3
  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: 6ad72f23f13ffa99a92bc816afbd49f64bc374e9
      https://github.com/Perl/perl5/commit/6ad72f23f13ffa99a92bc816afbd49f64bc374e9
  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: 8d56933fe0aa2db87b82bfacdd169089c161ab50
      https://github.com/Perl/perl5/commit/8d56933fe0aa2db87b82bfacdd169089c161ab50
  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: 7d978bdb002f962af4247604f562690254083cfd
      https://github.com/Perl/perl5/commit/7d978bdb002f962af4247604f562690254083cfd
  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: 1e182e152f65d3561f467c289e15daa8ce8ba15a
      https://github.com/Perl/perl5/commit/1e182e152f65d3561f467c289e15daa8ce8ba15a
  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: 748e1617b7dfe6bbbff650c8cf3432d9027585d5
      https://github.com/Perl/perl5/commit/748e1617b7dfe6bbbff650c8cf3432d9027585d5
  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: 0cf8036b0eb44ed49aa5f25b6a6a9860eefbdd8d
      https://github.com/Perl/perl5/commit/0cf8036b0eb44ed49aa5f25b6a6a9860eefbdd8d
  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: 6d7900f4f8d2c7edc2f1afb94d986e517da2c539
      https://github.com/Perl/perl5/commit/6d7900f4f8d2c7edc2f1afb94d986e517da2c539
  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: ce4a90dcaa136f64d8e496894b2e042f5d775372
      https://github.com/Perl/perl5/commit/ce4a90dcaa136f64d8e496894b2e042f5d775372
  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: 22917b707ce72be09770fb92da2d7db618752abc
      https://github.com/Perl/perl5/commit/22917b707ce72be09770fb92da2d7db618752abc
  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: 1986f8a532ce35b7e9f05fd28223959808911320
      https://github.com/Perl/perl5/commit/1986f8a532ce35b7e9f05fd28223959808911320
  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: 514ea53d7b2b9cfd66fff3678c8da4f5364c8119
      https://github.com/Perl/perl5/commit/514ea53d7b2b9cfd66fff3678c8da4f5364c8119
  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: 253e61b45dc9ef343bf32f049cc55a330eeac901
      https://github.com/Perl/perl5/commit/253e61b45dc9ef343bf32f049cc55a330eeac901
  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: adebada0802185a8912ce8080d75975abd0dfadc
      https://github.com/Perl/perl5/commit/adebada0802185a8912ce8080d75975abd0dfadc
  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: ad0d7d7faa529628f4621ce1778c0136ee706b82
      https://github.com/Perl/perl5/commit/ad0d7d7faa529628f4621ce1778c0136ee706b82
  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: 53b0c8112ce3cf4e8db250d0ff40418e2008e9a3
      https://github.com/Perl/perl5/commit/53b0c8112ce3cf4e8db250d0ff40418e2008e9a3
  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: 0d21d92c0be4d387617a4da90a003b90288a5b12
      https://github.com/Perl/perl5/commit/0d21d92c0be4d387617a4da90a003b90288a5b12
  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: dae5767c57ff7e88fd854141e661f6378fbf039e
      https://github.com/Perl/perl5/commit/dae5767c57ff7e88fd854141e661f6378fbf039e
  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: 907fab3c596ee2182c11838cef6901757e656029
      https://github.com/Perl/perl5/commit/907fab3c596ee2182c11838cef6901757e656029
  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: 776d654afa13a02be7ad2f25e9622aaceba0634b
      https://github.com/Perl/perl5/commit/776d654afa13a02be7ad2f25e9622aaceba0634b
  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: 3f8bdd5efccd0b53c9c3b6096261612a12ffe010
      https://github.com/Perl/perl5/commit/3f8bdd5efccd0b53c9c3b6096261612a12ffe010
  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: 138137b022c348bf5d27d38c9186c1ea24cb5cd0
      https://github.com/Perl/perl5/commit/138137b022c348bf5d27d38c9186c1ea24cb5cd0
  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: 0ffc9d94d97192748d67102ba6083b1bf27d4975
      https://github.com/Perl/perl5/commit/0ffc9d94d97192748d67102ba6083b1bf27d4975
  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: f989867edd3749da53dff5bb7775fc914d847134
      https://github.com/Perl/perl5/commit/f989867edd3749da53dff5bb7775fc914d847134
  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: 73a6fc00ef35f4217353fca6c0a4c0e7f990fd1d
      https://github.com/Perl/perl5/commit/73a6fc00ef35f4217353fca6c0a4c0e7f990fd1d
  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: 352650235e584df103d16a0dadc1192a2907ca96
      https://github.com/Perl/perl5/commit/352650235e584df103d16a0dadc1192a2907ca96
  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: e4e70fc7d85660394a2bfcbe8f85990523c5ae97
      https://github.com/Perl/perl5/commit/e4e70fc7d85660394a2bfcbe8f85990523c5ae97
  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: 7e17f0d055c6cf1a2112da8322e2f52dc476cf13
      https://github.com/Perl/perl5/commit/7e17f0d055c6cf1a2112da8322e2f52dc476cf13
  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: 928890ec8f98bee9e9083e057a4be795ffb13cae
      https://github.com/Perl/perl5/commit/928890ec8f98bee9e9083e057a4be795ffb13cae
  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: 958f42332eac82996a1c222eb547f8047ed0d53b
      https://github.com/Perl/perl5/commit/958f42332eac82996a1c222eb547f8047ed0d53b
  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: c4cfa4b71bb3b4858fe1b7d20009c9f62db558af
      https://github.com/Perl/perl5/commit/c4cfa4b71bb3b4858fe1b7d20009c9f62db558af
  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: 9fa1b853e728c3b6e0bea696dd8e55d9192eed94
      https://github.com/Perl/perl5/commit/9fa1b853e728c3b6e0bea696dd8e55d9192eed94
  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: 36f6058a325ce7764a7fdc4f67fbce1c7b1724ae
      https://github.com/Perl/perl5/commit/36f6058a325ce7764a7fdc4f67fbce1c7b1724ae
  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: e136cccdde18db2a3efa1084512ce0c2f7a90e79
      https://github.com/Perl/perl5/commit/e136cccdde18db2a3efa1084512ce0c2f7a90e79
  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: 83ed999531e9742c9384a821c671297fb1350c2b
      https://github.com/Perl/perl5/commit/83ed999531e9742c9384a821c671297fb1350c2b
  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: 39663b0eff2b800a0b681bf533dabde4d39e1fa9
      https://github.com/Perl/perl5/commit/39663b0eff2b800a0b681bf533dabde4d39e1fa9
  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: d6d439d583cb79ece1f307b885886afbba8ae672
      https://github.com/Perl/perl5/commit/d6d439d583cb79ece1f307b885886afbba8ae672
  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: 3998e02b85af557973c3ba72307b2626bbe67ad9
      https://github.com/Perl/perl5/commit/3998e02b85af557973c3ba72307b2626bbe67ad9
  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: 8aa02e435812da1817e979fb0087cf50742da5f5
      https://github.com/Perl/perl5/commit/8aa02e435812da1817e979fb0087cf50742da5f5
  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: ae939090d6171cb08c7232223349136cd08ccd03
      https://github.com/Perl/perl5/commit/ae939090d6171cb08c7232223349136cd08ccd03
  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: d536167e5ab47dca824d8cea32d74b43c684796d
      https://github.com/Perl/perl5/commit/d536167e5ab47dca824d8cea32d74b43c684796d
  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: 4630fd1845447f8b3bb419dc054ba335081aa0cc
      https://github.com/Perl/perl5/commit/4630fd1845447f8b3bb419dc054ba335081aa0cc
  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: d1f1a3b5520dbe1bba1b99141ac7f557ef96caf5
      https://github.com/Perl/perl5/commit/d1f1a3b5520dbe1bba1b99141ac7f557ef96caf5
  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: 0fd90d4d0ecd8b238ac98f18f7e4978648cd5307
      https://github.com/Perl/perl5/commit/0fd90d4d0ecd8b238ac98f18f7e4978648cd5307
  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: 0fd065a7ec1dc474932afe61954376c0519a2e9d
      https://github.com/Perl/perl5/commit/0fd065a7ec1dc474932afe61954376c0519a2e9d
  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: 5e9a638ae93f3184e4d0b9ce55cd7b66b94de177
      https://github.com/Perl/perl5/commit/5e9a638ae93f3184e4d0b9ce55cd7b66b94de177
  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: 2118fbe1fff86bb91f2868918ebcdef3c96e23e0
      https://github.com/Perl/perl5/commit/2118fbe1fff86bb91f2868918ebcdef3c96e23e0
  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: b69c984d610dbe6b23f8c6a93028e8fbcc6327ce
      https://github.com/Perl/perl5/commit/b69c984d610dbe6b23f8c6a93028e8fbcc6327ce
  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: 328fa68a5407d99d8829204c537350008e30cf67
      https://github.com/Perl/perl5/commit/328fa68a5407d99d8829204c537350008e30cf67
  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: 5668bf4a9e6f382a5738714eab3c00bbb6c59636
      https://github.com/Perl/perl5/commit/5668bf4a9e6f382a5738714eab3c00bbb6c59636
  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: bea9fa2ef81e91830184a91943d85c8bc149bac0
      https://github.com/Perl/perl5/commit/bea9fa2ef81e91830184a91943d85c8bc149bac0
  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: c6c21bf1186be9f4e9fc611bb8d721443b1b0ac8
      https://github.com/Perl/perl5/commit/c6c21bf1186be9f4e9fc611bb8d721443b1b0ac8
  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: 30f9e2ddd394c18af05895d923ce28727c1e3a91
      https://github.com/Perl/perl5/commit/30f9e2ddd394c18af05895d923ce28727c1e3a91
  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: e07e632bc3f9238df7b8e9f2c16f8994b8641a9d
      https://github.com/Perl/perl5/commit/e07e632bc3f9238df7b8e9f2c16f8994b8641a9d
  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: ec4fa21a4eea9869c80061ea494b3612bfc36d68
      https://github.com/Perl/perl5/commit/ec4fa21a4eea9869c80061ea494b3612bfc36d68
  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: 24e93ea02d9f0e37c5db20253ef0311b89bb31b0
      https://github.com/Perl/perl5/commit/24e93ea02d9f0e37c5db20253ef0311b89bb31b0
  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: 3f7bddcb975225712028e2595a6745e5faf5314e
      https://github.com/Perl/perl5/commit/3f7bddcb975225712028e2595a6745e5faf5314e
  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: 53ebacd89fd2076040e41754b6c781c4a4ae766b
      https://github.com/Perl/perl5/commit/53ebacd89fd2076040e41754b6c781c4a4ae766b
  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: 6ccb4e24cdcc01c3b1477c2695b4d472c14f7584
      https://github.com/Perl/perl5/commit/6ccb4e24cdcc01c3b1477c2695b4d472c14f7584
  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: 6ae1275e492e67dcd3b21bb25ad131c4ecbea3c9
      https://github.com/Perl/perl5/commit/6ae1275e492e67dcd3b21bb25ad131c4ecbea3c9
  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: b9da0b4bd781887dc07ee2fcfecd978873ad7e1c
      https://github.com/Perl/perl5/commit/b9da0b4bd781887dc07ee2fcfecd978873ad7e1c
  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: 49e48f6dae94796fd31223302f428d64db876b0b
      https://github.com/Perl/perl5/commit/49e48f6dae94796fd31223302f428d64db876b0b
  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: 59ed79932e4a2087ac7343f64935da186ae5ad85
      https://github.com/Perl/perl5/commit/59ed79932e4a2087ac7343f64935da186ae5ad85
  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: abb3b159e56a497958518f8b44ed63c3911fb0c5
      https://github.com/Perl/perl5/commit/abb3b159e56a497958518f8b44ed63c3911fb0c5
  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: 1f0b44f3ca4678bbd14b4b9cce5ef44f7c359927
      https://github.com/Perl/perl5/commit/1f0b44f3ca4678bbd14b4b9cce5ef44f7c359927
  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: 73a4076eeb6e9d759d81ab0bdc06e143b2796c2d
      https://github.com/Perl/perl5/commit/73a4076eeb6e9d759d81ab0bdc06e143b2796c2d
  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: 546561f71e3a72b578a350e1543c45f6a8fc94f2
      https://github.com/Perl/perl5/commit/546561f71e3a72b578a350e1543c45f6a8fc94f2
  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: 8a423980fce292a17ce132d20b3220e91b820808
      https://github.com/Perl/perl5/commit/8a423980fce292a17ce132d20b3220e91b820808
  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: 6036677761b22bbf209589b6ae1fda2b76679900
      https://github.com/Perl/perl5/commit/6036677761b22bbf209589b6ae1fda2b76679900
  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: 443cef34d5dea970d71158bb8bc7da74dc01a5bb
      https://github.com/Perl/perl5/commit/443cef34d5dea970d71158bb8bc7da74dc01a5bb
  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: 1e05f2f4e04ca33007e76890a543f475886b372b
      https://github.com/Perl/perl5/commit/1e05f2f4e04ca33007e76890a543f475886b372b
  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: fe026e877a0e136e29e81ceab153dec0d24eb793
      https://github.com/Perl/perl5/commit/fe026e877a0e136e29e81ceab153dec0d24eb793
  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: 10e89d4e358cd32d3ec3954b65f2ba03a85b04cd
      https://github.com/Perl/perl5/commit/10e89d4e358cd32d3ec3954b65f2ba03a85b04cd
  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: 3b0e2fa7693a7cb414dd3337545956d157e51ac8
      https://github.com/Perl/perl5/commit/3b0e2fa7693a7cb414dd3337545956d157e51ac8
  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: 8926796aac620d29dbc23cb5e0a5216fd04982cd
      https://github.com/Perl/perl5/commit/8926796aac620d29dbc23cb5e0a5216fd04982cd
  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: f3eb89305ea1aa8b7f3fbd050237b923337d04f5
      https://github.com/Perl/perl5/commit/f3eb89305ea1aa8b7f3fbd050237b923337d04f5
  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: cfc6998604555febe43c9e983f676ca2b84a1abb
      https://github.com/Perl/perl5/commit/cfc6998604555febe43c9e983f676ca2b84a1abb
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M cygwin/cygwin.c

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


  Commit: e576b6b5b9ffef3404d127f4a9b738d752e4e312
      https://github.com/Perl/perl5/commit/e576b6b5b9ffef3404d127f4a9b738d752e4e312
  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: 4fefa83593e935ba9180407524afcb83b6c5038e
      https://github.com/Perl/perl5/commit/4fefa83593e935ba9180407524afcb83b6c5038e
  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: 884b8147ae7576f157a19b320513d0896ab1dc36
      https://github.com/Perl/perl5/commit/884b8147ae7576f157a19b320513d0896ab1dc36
  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: a391d84946cadc3b53f25b3c1b4cbbb33aa34354
      https://github.com/Perl/perl5/commit/a391d84946cadc3b53f25b3c1b4cbbb33aa34354
  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: 05da043f309da81f05a1f024b4a7737311dd7eeb
      https://github.com/Perl/perl5/commit/05da043f309da81f05a1f024b4a7737311dd7eeb
  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: 965d593fbfe79386f4333a21111398905ce24883
      https://github.com/Perl/perl5/commit/965d593fbfe79386f4333a21111398905ce24883
  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: 9b0aac319d97cb62a99731d84eb364d329a90c2c
      https://github.com/Perl/perl5/commit/9b0aac319d97cb62a99731d84eb364d329a90c2c
  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: 8ed8489dd2dd44dc9fe17ba56c7bcd9a6d36a7e6
      https://github.com/Perl/perl5/commit/8ed8489dd2dd44dc9fe17ba56c7bcd9a6d36a7e6
  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: 81818fd98cb18ba54b4a74d8a7f573a99a09e5f9
      https://github.com/Perl/perl5/commit/81818fd98cb18ba54b4a74d8a7f573a99a09e5f9
  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: 26ac3cf6e04eb7b3cca245e7fc430d47c7c9ad8e
      https://github.com/Perl/perl5/commit/26ac3cf6e04eb7b3cca245e7fc430d47c7c9ad8e
  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: 7e0c07a713f63b1049fb563da76f9c07f4af310b
      https://github.com/Perl/perl5/commit/7e0c07a713f63b1049fb563da76f9c07f4af310b
  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: 2277c77621cc4e67006f2245103ab8f4051e60e0
      https://github.com/Perl/perl5/commit/2277c77621cc4e67006f2245103ab8f4051e60e0
  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: 7aefbd252722b27c3bd49620bd81a8b7780378cf
      https://github.com/Perl/perl5/commit/7aefbd252722b27c3bd49620bd81a8b7780378cf
  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: b86143afd7958c46cd3d5b6a2c468db79058c7d5
      https://github.com/Perl/perl5/commit/b86143afd7958c46cd3d5b6a2c468db79058c7d5
  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: 9d9f8730c29a93e8eb07050347d89eca0fd0736a
      https://github.com/Perl/perl5/commit/9d9f8730c29a93e8eb07050347d89eca0fd0736a
  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: 408077f53164625b8824a0d4ac87d37ab53ab547
      https://github.com/Perl/perl5/commit/408077f53164625b8824a0d4ac87d37ab53ab547
  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: da8a553f79266665d895af7eb89774f04d10e42f
      https://github.com/Perl/perl5/commit/da8a553f79266665d895af7eb89774f04d10e42f
  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: 81593c6e4d50cb089c9f2d84ab7539b2300680d9
      https://github.com/Perl/perl5/commit/81593c6e4d50cb089c9f2d84ab7539b2300680d9
  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: 0f4c44c84459bd885ee287b2e4757aadd57230c6
      https://github.com/Perl/perl5/commit/0f4c44c84459bd885ee287b2e4757aadd57230c6
  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: f96a9c6ffb19897e65bfbe29bbc7c6ab64451733
      https://github.com/Perl/perl5/commit/f96a9c6ffb19897e65bfbe29bbc7c6ab64451733
  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: 4672e4b508e6e8c35a47d480bdba7c6c2256b0e9
      https://github.com/Perl/perl5/commit/4672e4b508e6e8c35a47d480bdba7c6c2256b0e9
  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: 9a86638e7b3bc92947b1fb779f89fcfd4c457f19
      https://github.com/Perl/perl5/commit/9a86638e7b3bc92947b1fb779f89fcfd4c457f19
  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: 60347e5327d1d725cd6ab3f32d5123b6b1e290df
      https://github.com/Perl/perl5/commit/60347e5327d1d725cd6ab3f32d5123b6b1e290df
  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: 7b6bb2aee9679dff738c38fb2032571e99ccd5dc
      https://github.com/Perl/perl5/commit/7b6bb2aee9679dff738c38fb2032571e99ccd5dc
  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: e1bc4593dcd365f1194f9dc324a2ed08452bfa52
      https://github.com/Perl/perl5/commit/e1bc4593dcd365f1194f9dc324a2ed08452bfa52
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

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


  Commit: f15615f9935fe6f11155e07c2d51129ce2da00a7
      https://github.com/Perl/perl5/commit/f15615f9935fe6f11155e07c2d51129ce2da00a7
  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: 06ef15f521241e3c809921c89c2c8389496aa10e
      https://github.com/Perl/perl5/commit/06ef15f521241e3c809921c89c2c8389496aa10e
  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: 9937dfbe337d525049fdbc38e77a19fb5b57fdeb
      https://github.com/Perl/perl5/commit/9937dfbe337d525049fdbc38e77a19fb5b57fdeb
  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: 882ad221dc1a2ca12112ca155e4e56095041eeb6
      https://github.com/Perl/perl5/commit/882ad221dc1a2ca12112ca155e4e56095041eeb6
  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: 49f1541131828b7fec933d6f21923b4d7037f17f
      https://github.com/Perl/perl5/commit/49f1541131828b7fec933d6f21923b4d7037f17f
  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: 06d623a2ad0d7a77eb1b1ecf6d491530ce22a415
      https://github.com/Perl/perl5/commit/06d623a2ad0d7a77eb1b1ecf6d491530ce22a415
  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: a7cc8cba1d2b3a7d498fba9fe5927ebb8d34ec8e
      https://github.com/Perl/perl5/commit/a7cc8cba1d2b3a7d498fba9fe5927ebb8d34ec8e
  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: f48207e0a45818dfcd93e0791bb852fc734e20c3
      https://github.com/Perl/perl5/commit/f48207e0a45818dfcd93e0791bb852fc734e20c3
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M locale.c

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


  Commit: e8c304e6db1b6f0b4b4539340e66020597e78a7c
      https://github.com/Perl/perl5/commit/e8c304e6db1b6f0b4b4539340e66020597e78a7c
  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: fb283097ec16c45d47590d640ad407782d5e9853
      https://github.com/Perl/perl5/commit/fb283097ec16c45d47590d640ad407782d5e9853
  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: 518ca7c1395316865efcc6464f36118011c0d294
      https://github.com/Perl/perl5/commit/518ca7c1395316865efcc6464f36118011c0d294
  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: 767e3089e8352ab3e0d7e4d16ab09edb4f94bf0f
      https://github.com/Perl/perl5/commit/767e3089e8352ab3e0d7e4d16ab09edb4f94bf0f
  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: 1787ee662e6f05b3b11d0e9ad298b7b65a8496db
      https://github.com/Perl/perl5/commit/1787ee662e6f05b3b11d0e9ad298b7b65a8496db
  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: 2cb225488c9fed49d5d03e666b0c544959001a94
      https://github.com/Perl/perl5/commit/2cb225488c9fed49d5d03e666b0c544959001a94
  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: a79f02d431cd1407abd8a28854401c8aac83d76e
      https://github.com/Perl/perl5/commit/a79f02d431cd1407abd8a28854401c8aac83d76e
  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: 827f33b7237147afb308d0492b5625fa6227069e
      https://github.com/Perl/perl5/commit/827f33b7237147afb308d0492b5625fa6227069e
  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: 87805b06d1e518f339ba951fc66b78326954ad4b
      https://github.com/Perl/perl5/commit/87805b06d1e518f339ba951fc66b78326954ad4b
  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


  Commit: 4ca8eefc0550de6e997600b4591e725a09514be5
      https://github.com/Perl/perl5/commit/4ca8eefc0550de6e997600b4591e725a09514be5
  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


Compare: https://github.com/Perl/perl5/compare/2ea6fb1433ba...4ca8eefc0550



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