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

[Perl/perl5] fbb3fc: Add ability to easily add info to DEBUG output

From:
Karl Williamson via perl5-changes
Date:
March 11, 2021 04:32
Subject:
[Perl/perl5] fbb3fc: Add ability to easily add info to DEBUG output
Message ID:
Perl/perl5/push/refs/heads/smoke-me/khw-locale/e42e61-3ff60b@github.com
  Branch: refs/heads/smoke-me/khw-locale
  Home:   https://github.com/Perl/perl5
  Commit: fbb3fcde769fcb0621a710c6ebd4fce9f3f42ab3
      https://github.com/Perl/perl5/commit/fbb3fcde769fcb0621a710c6ebd4fce9f3f42ab3
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M perl.h

  Log Message:
  -----------
  Add ability to easily add info to DEBUG output

This commit adds two macros that a user can define and recompile Perl to
get every active DEBUG statement to do  something beyond what it would
normally do.

This allows someone to recompile Perl when they need to delve deeper
into fixing a bug without increasing memory use or slowing execution
otherwise.


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

  Changed paths:
    M dosish.h
    M unixish.h

  Log Message:
  -----------
  Unixish.sh, doshish.sh: 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: 7f81af83c9c71041c097433672ec3edbed8fd3df
      https://github.com/Perl/perl5/commit/7f81af83c9c71041c097433672ec3edbed8fd3df
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M mg.c

  Log Message:
  -----------
  XXX better message: mg.c: Silence compiler warning


  Commit: 9211473c94becffa1d07278c984f1445a31ca3c0
      https://github.com/Perl/perl5/commit/9211473c94becffa1d07278c984f1445a31ca3c0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M cygwin/cygwin.c

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


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

  Changed paths:
    M lib/locale_threads.t

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


  Commit: 86397e8ba396d54a1ed5e4437eb44196215e1cfe
      https://github.com/Perl/perl5/commit/86397e8ba396d54a1ed5e4437eb44196215e1cfe
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 7247d749b92ee00157e7160ccdf35e38312364c9
      https://github.com/Perl/perl5/commit/7247d749b92ee00157e7160ccdf35e38312364c9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: cb9655d8a75fc69b00aa84e6c50734a6278e6b11
      https://github.com/Perl/perl5/commit/cb9655d8a75fc69b00aa84e6c50734a6278e6b11
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

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

  Log Message:
  -----------
  Change macro names to be C standard conformant

C reserves symbols beginning with underscores for its own use.  This
commit moves the underscore so it is trailing, which is legal.  The
symbols changed here are most of the ones in handy.h that have few uses
outside it.


  Commit: 445852e9faa7e94c5b058a77a1309da6ef5ad6bf
      https://github.com/Perl/perl5/commit/445852e9faa7e94c5b058a77a1309da6ef5ad6bf
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Refactor some #ifdef's for commonality

This changes these compilation conditionals so that things in common
between Windows and other platforms are only defined once.

It changes the isWORDCHAR_LC definition for non-Windows to match that
platform, adding an UNLIKELY().


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

  Changed paths:
    M handy.h

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


  Commit: 560f09e70f933d1f0b5174311be0a50ad42c74a9
      https://github.com/Perl/perl5/commit/560f09e70f933d1f0b5174311be0a50ad42c74a9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M handy.h

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

Replace isIDFIRST_LC  with a slightly faster implementation, in line
with what isWORDCHAR already does


  Commit: 69c8c3079c900a7ad4df8443407cb5aabb3c9d0a
      https://github.com/Perl/perl5/commit/69c8c3079c900a7ad4df8443407cb5aabb3c9d0a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M charclass_invlists.h
    M handy.h
    M l1_char_class_tab.h
    M lib/unicore/uni_keywords.pl
    M perl.c
    M perl.h
    M regcomp.c
    M regcomp.h
    M regen/mk_PL_charclass.pl
    M regexec.c
    M sv.c
    M uni_keywords.h
    M utfebcdic.h

  Log Message:
  -----------
  Change macro names to be C standard conformant

C reserves symbols beginning with underscores for its own use.  This
commit moves the underscore so it is trailing, which is legal.  The
symbols changed here are many of the ones in handy.h that have
significant uses outside it.


  Commit: 55cb0be3bbfbd7cc34b0d251cde206cb52021660
      https://github.com/Perl/perl5/commit/55cb0be3bbfbd7cc34b0d251cde206cb52021660
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Rmv unneeded generality

The possible first character of an ID is always an alpha in the range
0-255, so there is no harm changing from the former to the latter.  And
future changes would otherwise have needed an extra parameter in a bunch
of macros.


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

  Changed paths:
    M handy.h

  Log Message:
  -----------
  handy.h: Don't special case isASCII_LC

This was an attempt to save instructions, but future commits will need
the generality


  Commit: 73e793ded0e5faa368baca9637f35350e4efb940
      https://github.com/Perl/perl5/commit/73e793ded0e5faa368baca9637f35350e4efb940
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: ed43276ff9fef275752d4a855093f22d9414b64b
      https://github.com/Perl/perl5/commit/ed43276ff9fef275752d4a855093f22d9414b64b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M globvar.sym
    M handy.h
    M inline.h
    M perl.h
    M proto.h
    M regexec.c

  Log Message:
  -----------
  regexec.c: Use function call table to streamline code

This replaces a switch() statement with a function pointer table.  But
the main reason I'm doing this is for future functionality.


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

  Changed paths:
    M locale.c

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


  Commit: e61d8ff1e87e7eab33c2492b7fbd6e3243e4accf
      https://github.com/Perl/perl5/commit/e61d8ff1e87e7eab33c2492b7fbd6e3243e4accf
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 58246f7b621a803f0eb5a5ea440ca1403d0e27c6
      https://github.com/Perl/perl5/commit/58246f7b621a803f0eb5a5ea440ca1403d0e27c6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: ec37515ef95e44bd644af75ee80ae51147de88e4
      https://github.com/Perl/perl5/commit/ec37515ef95e44bd644af75ee80ae51147de88e4
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: a83d8b2c51910a8ea0cbd9f2b43929865caff033
      https://github.com/Perl/perl5/commit/a83d8b2c51910a8ea0cbd9f2b43929865caff033
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: c219d5e04170cf4839192275e27e6722698fee36
      https://github.com/Perl/perl5/commit/c219d5e04170cf4839192275e27e6722698fee36
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Change macro name

Adopt the git convention of 'porcelain' meaning without special
handling.  This makes it clear that porcelain_setlocale  macro is the
base level.


  Commit: df9d17704ff23366e03805552cbfceedd721cb17
      https://github.com/Perl/perl5/commit/df9d17704ff23366e03805552cbfceedd721cb17
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 980adae798bfd750879be084a3da7f7d2a1419d0
      https://github.com/Perl/perl5/commit/980adae798bfd750879be084a3da7f7d2a1419d0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

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

  Log Message:
  -----------
  locale.c: Create S_get_category_index()

libc locale categories, like LC_NUMERIC, are opaque integers.  This
makes it inconvenient to have table-driven code.  Instead, we have
tables that are indexed by small positive integers, which are a
compile-time mapping from the libc values.

This commit creates a run-time function to also do that mapping.  It
will first be used in the next commit.

The function does a loop through the available categories, looking for a
match.  It could be replaced by some sort of quick hash lookup, but the
largest arrays in the field have a max of 12 elements, with almost all
searches finding their quarry in the first 6.  It doesn't seem
worthwhile to me to replace a linear search of 6 elements by something
more complicated.  The design intent is this search will be used only at
the edgest of the locale-handling code; once found the index is used in
future bits of the current operation.


  Commit: 0d63f7ad1cd114e62c7a0281b73320ffd5512030
      https://github.com/Perl/perl5/commit/0d63f7ad1cd114e62c7a0281b73320ffd5512030
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: d1e749ca3923beaccb63095c84b3d254b81228bf
      https://github.com/Perl/perl5/commit/d1e749ca3923beaccb63095c84b3d254b81228bf
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 4bd85377ba00a56b1f5f04cd13dc2a243178f6ec
      https://github.com/Perl/perl5/commit/4bd85377ba00a56b1f5f04cd13dc2a243178f6ec
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use nocontext; avoid rarely needed dTHX

This is a rare case; no point in doing a dTHX just for it.


  Commit: 5427966be71906938870e49ad21f6a462776f500
      https://github.com/Perl/perl5/commit/5427966be71906938870e49ad21f6a462776f500
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: a29d1590e30325b653fb7b43606993db48a14f15
      https://github.com/Perl/perl5/commit/a29d1590e30325b653fb7b43606993db48a14f15
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: c95d6eb37781ab74e7aaf5ccf81a5d3d2114ce57
      https://github.com/Perl/perl5/commit/c95d6eb37781ab74e7aaf5ccf81a5d3d2114ce57
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 5f4524d7d852002daf9c868e6016b8b2918c7e49
      https://github.com/Perl/perl5/commit/5f4524d7d852002daf9c868e6016b8b2918c7e49
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 480dea74227054e84747c83ca380d38984ffb7e5
      https://github.com/Perl/perl5/commit/480dea74227054e84747c83ca380d38984ffb7e5
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 0da454ea4e79daf08192184bc9dcf3a3998bfb8a
      https://github.com/Perl/perl5/commit/0da454ea4e79daf08192184bc9dcf3a3998bfb8a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 2580c22e218ec957929ff73bfa90f7ea809d69de
      https://github.com/Perl/perl5/commit/2580c22e218ec957929ff73bfa90f7ea809d69de
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 9c53c65cce2803e2ec98b535ba2a5bfd8b55583e
      https://github.com/Perl/perl5/commit/9c53c65cce2803e2ec98b535ba2a5bfd8b55583e
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: eb10f5f9436026929c79e1f52cc595007efedbe4
      https://github.com/Perl/perl5/commit/eb10f5f9436026929c79e1f52cc595007efedbe4
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: eeceda1b3d9f4b11d8a09c5e0527aa8d3e626244
      https://github.com/Perl/perl5/commit/eeceda1b3d9f4b11d8a09c5e0527aa8d3e626244
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: acd35e52a50757ac4921644a00a77520e75e3411
      https://github.com/Perl/perl5/commit/acd35e52a50757ac4921644a00a77520e75e3411
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 8b62971fad611a62e82a54949fa518483481a3f0
      https://github.com/Perl/perl5/commit/8b62971fad611a62e82a54949fa518483481a3f0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: c31200f84f3fda95a6d2e5a24dd4a7f9f558b54a
      https://github.com/Perl/perl5/commit/c31200f84f3fda95a6d2e5a24dd4a7f9f558b54a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 1d5ebe27d761cb273023cbf0e3470238a7ffbf52
      https://github.com/Perl/perl5/commit/1d5ebe27d761cb273023cbf0e3470238a7ffbf52
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 89013c5cdbad25dfc93b50a1a0e6122e1e14a149
      https://github.com/Perl/perl5/commit/89013c5cdbad25dfc93b50a1a0e6122e1e14a149
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 41776b565fb2513f6d49ad75d4f799d5e58fbfd9
      https://github.com/Perl/perl5/commit/41776b565fb2513f6d49ad75d4f799d5e58fbfd9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

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

  Log Message:
  -----------
  locale.c: querylocale() doesn't work on LC_ALL

I had misread the man pages.  This bug has been in the field for several
releases now, but most likely hasn't shown up because it's almost always
the case that the locale categories will be set to the same locale.  And
so most implementations of querylocale() would return the correct
result.

This commit works by splitting the calculation of the value of LC_ALL
from S_emulate_setlocale_i() into a separate function, and extending it
to work on querylocale() systems.  This has the added benefit of
removing tangential code from the main line, making
S_emulate_setlocale_i easier to read.

calculate_LC_ALL() is the new function, and is now called from two
places.

Part of this change is to keep our records of LC_ALL on non-querylocale
systems always up-to-date, which is better practice

And part of this change is temporary, marked as such, to be removed a
few commits later.


  Commit: 97ccbdbb8ba18f176fddbeeb9db2ddddb927994b
      https://github.com/Perl/perl5/commit/97ccbdbb8ba18f176fddbeeb9db2ddddb927994b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 8168e1ed4eb47c0db12a0f4ab73cd2befeff77f5
      https://github.com/Perl/perl5/commit/8168e1ed4eb47c0db12a0f4ab73cd2befeff77f5
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c
    M perl.h

  Log Message:
  -----------
  Allow use of glibc undocumented locale fcn

glibc does not furnish querylocale() that Darwin and *BSD systems do.
But glibc does provide a long-standing, undocumented querylocale
equivalent.

Perl provides a workaround for systems without querylocale(), but this
commit causes -Accflags=-DUSE_NL_LOCALE_NAME when passed to Configure to
use the undocumented function instead of the workaround.  For now, I am
not otherwise documenting this ability, since the underlying function
isn't documented.


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

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

  Log Message:
  -----------
  locale.c: Split aggregate LC_ALL from emulate_setlocale

This splits into a separate function the code necessary in some
Configurations to calculate LC_ALL from a potentially disparate
aggregate of categories having different locales.

This done just for readability, as this extensive code in the middle of
something else distracts from the main point.

A goto is hence replaced by a recursive call.


  Commit: 1308ece6b24cbd4527c6e80f37dcd3e53bf5812c
      https://github.com/Perl/perl5/commit/1308ece6b24cbd4527c6e80f37dcd3e53bf5812c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 08d7ad256c6e667996af3d51ccc7f666b4280755
      https://github.com/Perl/perl5/commit/08d7ad256c6e667996af3d51ccc7f666b4280755
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 12ab082de61d648d86b60d04dc483f91bc45e898
      https://github.com/Perl/perl5/commit/12ab082de61d648d86b60d04dc483f91bc45e898
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: daff2d0f7aa68023c6917ae9ec641283098d8f40
      https://github.com/Perl/perl5/commit/daff2d0f7aa68023c6917ae9ec641283098d8f40
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 3d7a10c88edc9369c17bb0d1faeaa448a0a7e8b6
      https://github.com/Perl/perl5/commit/3d7a10c88edc9369c17bb0d1faeaa448a0a7e8b6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 7f5f02c883719571f8324f5604181522b10175aa
      https://github.com/Perl/perl5/commit/7f5f02c883719571f8324f5604181522b10175aa
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: e00ae50a74afd5cd403df00a2c6d47b696477a88
      https://github.com/Perl/perl5/commit/e00ae50a74afd5cd403df00a2c6d47b696477a88
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: aba6757d0316747d060096673c55f84d254fc206
      https://github.com/Perl/perl5/commit/aba6757d0316747d060096673c55f84d254fc206
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 7965afbb505078afbb02bf08bde50b54c160f7c0
      https://github.com/Perl/perl5/commit/7965afbb505078afbb02bf08bde50b54c160f7c0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 98d5841131819401270776acb8029508c84c35ec
      https://github.com/Perl/perl5/commit/98d5841131819401270776acb8029508c84c35ec
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: c032a8e384b1efe1760c46e2e26442e6e148d210
      https://github.com/Perl/perl5/commit/c032a8e384b1efe1760c46e2e26442e6e148d210
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M ext/POSIX/POSIX.xs

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

Properly indent some nested preprocessor directives


  Commit: 149bea1a3abfe82d58f078fda5b1046862605e9d
      https://github.com/Perl/perl5/commit/149bea1a3abfe82d58f078fda5b1046862605e9d
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 9c5de547ecd26918d8176eef770954738682d44e
      https://github.com/Perl/perl5/commit/9c5de547ecd26918d8176eef770954738682d44e
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: c8c69f0cf97a93072acedbf0e7c9c297422de5e6
      https://github.com/Perl/perl5/commit/c8c69f0cf97a93072acedbf0e7c9c297422de5e6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 1c823434c683045c363ea3a1592c79f13610dfce
      https://github.com/Perl/perl5/commit/1c823434c683045c363ea3a1592c79f13610dfce
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 91842a83d400112df993e15a125f7164f9e8c9c0
      https://github.com/Perl/perl5/commit/91842a83d400112df993e15a125f7164f9e8c9c0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 22e529d57687f2a68f8a22f8b15f0549fbfb40c4
      https://github.com/Perl/perl5/commit/22e529d57687f2a68f8a22f8b15f0549fbfb40c4
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: d8e8ff2c7bcf0f15fb53ce48781f675bce83c3ec
      https://github.com/Perl/perl5/commit/d8e8ff2c7bcf0f15fb53ce48781f675bce83c3ec
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 7bc6e6193a4040fffefaef24309e8a0a7e46ac07
      https://github.com/Perl/perl5/commit/7bc6e6193a4040fffefaef24309e8a0a7e46ac07
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 85676578758f07a0e0a1f89a568e820270c87633
      https://github.com/Perl/perl5/commit/85676578758f07a0e0a1f89a568e820270c87633
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

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

This allows some preprocessor conditionals to be removed


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

  Changed paths:
    M locale.c

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

strEQ and && already return booleans


  Commit: 3a3a38dc7ea7edb25c6944d4b33102ba54c466cd
      https://github.com/Perl/perl5/commit/3a3a38dc7ea7edb25c6944d4b33102ba54c466cd
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 25c4c9271b0b9d8023e99a53141763c3c25fd970
      https://github.com/Perl/perl5/commit/25c4c9271b0b9d8023e99a53141763c3c25fd970
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: d8e07d9626d538560c932cdfb8fd301a9463d0fd
      https://github.com/Perl/perl5/commit/d8e07d9626d538560c932cdfb8fd301a9463d0fd
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 6f175df8c3f8ac5625d5d2b1c2ec3ef6dd24be9e
      https://github.com/Perl/perl5/commit/6f175df8c3f8ac5625d5d2b1c2ec3ef6dd24be9e
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: bf38a6e1a5789ec41695043ac869cf3c5080728a
      https://github.com/Perl/perl5/commit/bf38a6e1a5789ec41695043ac869cf3c5080728a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Don't change locale if already there

Changing the locale is cheap for some categories, but expensive for
others.  Changing LC_COLLATE is most expensive, requiring recalculation
of the collation transformation mapping.

This commit checks before blindly changing locales that we aren't
already in the desired one, in which case this could be just as well a
no-op, and with this commit becomes one.


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

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

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

This adds some compile safety to these.


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

  Changed paths:
    M locale.c

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

This is in preparation for the next commit


  Commit: 73db7818b7451e31ef24f9e78324832600f5e3e2
      https://github.com/Perl/perl5/commit/73db7818b7451e31ef24f9e78324832600f5e3e2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 3215a0319da5bb48aefd036777f27bcbe6597b42
      https://github.com/Perl/perl5/commit/3215a0319da5bb48aefd036777f27bcbe6597b42
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 6cfb818b13dd97f981e7723932e71ab950f5beb7
      https://github.com/Perl/perl5/commit/6cfb818b13dd97f981e7723932e71ab950f5beb7
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: cef40e866d9730012389cb1f3eb15724c9dcd9fe
      https://github.com/Perl/perl5/commit/cef40e866d9730012389cb1f3eb15724c9dcd9fe
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 5503126f29b3a338cfa5d999b7ff0b1bb8a983f6
      https://github.com/Perl/perl5/commit/5503126f29b3a338cfa5d999b7ff0b1bb8a983f6
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 168ee0f6b06d022223fd7e60f47ef24abd187fc0
      https://github.com/Perl/perl5/commit/168ee0f6b06d022223fd7e60f47ef24abd187fc0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: a9c6094b0cdbb3c2832eb94ce76724851801cd0c
      https://github.com/Perl/perl5/commit/a9c6094b0cdbb3c2832eb94ce76724851801cd0c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 51f79467542524f97f00f1d005cffc05b2733a3b
      https://github.com/Perl/perl5/commit/51f79467542524f97f00f1d005cffc05b2733a3b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 25e8899da832b64e1e5be676756fe63ffa344d83
      https://github.com/Perl/perl5/commit/25e8899da832b64e1e5be676756fe63ffa344d83
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 078305111d7f95264f137ead8f2bb85e81d211b0
      https://github.com/Perl/perl5/commit/078305111d7f95264f137ead8f2bb85e81d211b0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: af0237d86ce88b341d36b7538816e77f363220a2
      https://github.com/Perl/perl5/commit/af0237d86ce88b341d36b7538816e77f363220a2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 48be2d3af2aa60bccb4d2c7008e75c56f22a2126
      https://github.com/Perl/perl5/commit/48be2d3af2aa60bccb4d2c7008e75c56f22a2126
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: d5611f7a0c465f463fffed326eb3bb74066b7f02
      https://github.com/Perl/perl5/commit/d5611f7a0c465f463fffed326eb3bb74066b7f02
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: e373f5d10eaff58d3602309f631a88f4008a9bf5
      https://github.com/Perl/perl5/commit/e373f5d10eaff58d3602309f631a88f4008a9bf5
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: bbb69ecaf5e498f79a86e4597106251b0c1401d1
      https://github.com/Perl/perl5/commit/bbb69ecaf5e498f79a86e4597106251b0c1401d1
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

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


  Commit: 45ee6a3d5d02171806ad17f4e2f4f207d2622184
      https://github.com/Perl/perl5/commit/45ee6a3d5d02171806ad17f4e2f4f207d2622184
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 40438886334dabfcec80b555f4caa216ecb12768
      https://github.com/Perl/perl5/commit/40438886334dabfcec80b555f4caa216ecb12768
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 47f6b857911c2a2821b0cdf880a68a8a0c2a2a17
      https://github.com/Perl/perl5/commit/47f6b857911c2a2821b0cdf880a68a8a0c2a2a17
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 2024fb9109185e42eed8894100316a066f069b17
      https://github.com/Perl/perl5/commit/2024fb9109185e42eed8894100316a066f069b17
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M mg.c

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

Indent newly formed block from the previous commit.


  Commit: 675e7dc52f4350b000f717c09f2b68bbea771f45
      https://github.com/Perl/perl5/commit/675e7dc52f4350b000f717c09f2b68bbea771f45
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 761a113064eac67ee0f2289ab1c573358d1194d3
      https://github.com/Perl/perl5/commit/761a113064eac67ee0f2289ab1c573358d1194d3
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 6b410555b94e9d277e6990cd00c94c4a01ecf33a
      https://github.com/Perl/perl5/commit/6b410555b94e9d277e6990cd00c94c4a01ecf33a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: d3888b83e2cbab3cfe7a3fc0b7b4f3cdea90cbe7
      https://github.com/Perl/perl5/commit/d3888b83e2cbab3cfe7a3fc0b7b4f3cdea90cbe7
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 1d379f5ce66cd869529e1c7522dfd23153e9b37c
      https://github.com/Perl/perl5/commit/1d379f5ce66cd869529e1c7522dfd23153e9b37c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 2059e9f20242df14f14711abcbfbe288c2f7f3e9
      https://github.com/Perl/perl5/commit/2059e9f20242df14f14711abcbfbe288c2f7f3e9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: dfa9a7e51a3516a141fe160ef2d6e4689cd46f49
      https://github.com/Perl/perl5/commit/dfa9a7e51a3516a141fe160ef2d6e4689cd46f49
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 1053bdb5958ad49a1bafb3a9ff2485b4df07c6b9
      https://github.com/Perl/perl5/commit/1053bdb5958ad49a1bafb3a9ff2485b4df07c6b9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: d128225d7e3ac0669297188b18fb8269b249e238
      https://github.com/Perl/perl5/commit/d128225d7e3ac0669297188b18fb8269b249e238
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 6d66babaa4edf54a61c19388d4f29968ed288368
      https://github.com/Perl/perl5/commit/6d66babaa4edf54a61c19388d4f29968ed288368
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 0dbd4e402731f3a427c5a628bdd3fe8024c50968
      https://github.com/Perl/perl5/commit/0dbd4e402731f3a427c5a628bdd3fe8024c50968
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 3d9b144d25a7f51189a1f2e183ee46894ce88950
      https://github.com/Perl/perl5/commit/3d9b144d25a7f51189a1f2e183ee46894ce88950
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Move DEBUG location info

This commit takes advantage of the new mechanism to add common DEBUGGING
code to print the __FILE__ and __LINE__ of every debugging statement.
This allows those to be removed from each statement, and have them
implicitly added.

This make things consistent, and easier to read and add new statements.


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

  Changed paths:
    M locale.c

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


  Commit: 91f0a0d73eadeb1d6745ed4b7e4ae11a811672b2
      https://github.com/Perl/perl5/commit/91f0a0d73eadeb1d6745ed4b7e4ae11a811672b2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: df897f03a87568892a46a674affbf5087ec2e46a
      https://github.com/Perl/perl5/commit/df897f03a87568892a46a674affbf5087ec2e46a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 11e12563098cf37095ee990effcb2bd74e8c5ed2
      https://github.com/Perl/perl5/commit/11e12563098cf37095ee990effcb2bd74e8c5ed2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 07bdb9ea74644b196f495f80cd7a846702637ae8
      https://github.com/Perl/perl5/commit/07bdb9ea74644b196f495f80cd7a846702637ae8
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

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


  Commit: 5c072e9eebb038cf9cf07431ef0611cea408e57f
      https://github.com/Perl/perl5/commit/5c072e9eebb038cf9cf07431ef0611cea408e57f
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: ce125176809ba73adb0a55a425fa8bef9e82338b
      https://github.com/Perl/perl5/commit/ce125176809ba73adb0a55a425fa8bef9e82338b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 66b1ccef1ac8f7005b662ec1022ade08b8b8a254
      https://github.com/Perl/perl5/commit/66b1ccef1ac8f7005b662ec1022ade08b8b8a254
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: f9e0e51fc647e26e37046c1a1cb6177236b876c0
      https://github.com/Perl/perl5/commit/f9e0e51fc647e26e37046c1a1cb6177236b876c0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 3ff00f78bf5407c671f3b2be0ba6f12bd23ce005
      https://github.com/Perl/perl5/commit/3ff00f78bf5407c671f3b2be0ba6f12bd23ce005
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: d6c46650cdcb25616a794b243060fa37d164f5b7
      https://github.com/Perl/perl5/commit/d6c46650cdcb25616a794b243060fa37d164f5b7
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M lib/locale.t

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


  Commit: ba1ab444853fe52a50ef8c1247812e64aa1a8bd5
      https://github.com/Perl/perl5/commit/ba1ab444853fe52a50ef8c1247812e64aa1a8bd5
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: b3575d01310c267832c8ae3e029bd7fec66c794c
      https://github.com/Perl/perl5/commit/b3575d01310c267832c8ae3e029bd7fec66c794c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 8ef9ee08f439df18aacca2205de6782ff6a15ce0
      https://github.com/Perl/perl5/commit/8ef9ee08f439df18aacca2205de6782ff6a15ce0
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  extra debug


  Commit: 7f3666711b50001a53e87b0a28d23fb17409c5c4
      https://github.com/Perl/perl5/commit/7f3666711b50001a53e87b0a28d23fb17409c5c4
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 25081cdc3ff3e9f04f6d88c9c57b7027803c4897
      https://github.com/Perl/perl5/commit/25081cdc3ff3e9f04f6d88c9c57b7027803c4897
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  XXX f inRANGE


  Commit: 64d5619c3e2beecffd53e1a3b3af944e9ddbb60a
      https://github.com/Perl/perl5/commit/64d5619c3e2beecffd53e1a3b3af944e9ddbb60a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 970f24401ac218f3e5148515251156c61912cb58
      https://github.com/Perl/perl5/commit/970f24401ac218f3e5148515251156c61912cb58
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 8dccc0d28f464b20e94a3c90f9ccd4220924d3f2
      https://github.com/Perl/perl5/commit/8dccc0d28f464b20e94a3c90f9ccd4220924d3f2
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: a8edcae03c4e3878eb20565a81874c6c0a96ecea
      https://github.com/Perl/perl5/commit/a8edcae03c4e3878eb20565a81874c6c0a96ecea
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: d896ac2cf328497801547ea329286c107057c39f
      https://github.com/Perl/perl5/commit/d896ac2cf328497801547ea329286c107057c39f
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: 6cc10058bef89134c48c2ca17ad6faa534b0764c
      https://github.com/Perl/perl5/commit/6cc10058bef89134c48c2ca17ad6faa534b0764c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: f21a46a30b607667ab3b94910a51988394ca39fe
      https://github.com/Perl/perl5/commit/f21a46a30b607667ab3b94910a51988394ca39fe
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 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: dedbb096b10d6a9037643b5fcc814fb582923c65
      https://github.com/Perl/perl5/commit/dedbb096b10d6a9037643b5fcc814fb582923c65
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c
    M perl.h

  Log Message:
  -----------
  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 setlocalwes 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: 6da5698cf2df938db20e8d1580ace1bf274f8805
      https://github.com/Perl/perl5/commit/6da5698cf2df938db20e8d1580ace1bf274f8805
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M perl.h

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

This simplifies slightly, and will allow further simplification


  Commit: 7527099739f335804a23040fb42d5556a67e5513
      https://github.com/Perl/perl5/commit/7527099739f335804a23040fb42d5556a67e5513
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M perl.h

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

To enable future simplifications


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

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h Simplify some locale-related defns

This removes some conditionals made redundant by previous commits.


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

  Changed paths:
    M embed.fnc
    M embed.h
    M embedvar.h
    M ext/POSIX/POSIX.xs
    M handy.h
    M inline.h
    M intrpvar.h
    M lib/locale_threads.t
    M locale.c
    M makedef.pl
    M perl.c
    M perl.h
    M proto.h
    M sv.c
    M util.c

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

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  loc tools after emulation


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

  Changed paths:
    M pp.c

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


  Commit: 15ff92227e6f2e04b92c3b75f7a6a0ad4c04446b
      https://github.com/Perl/perl5/commit/15ff92227e6f2e04b92c3b75f7a6a0ad4c04446b
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

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

  Log Message:
  -----------
  XXX finish fold_locale

tests, copy in thread create


  Commit: 5006b450deadfb59170a0e0526f9b350a3721576
      https://github.com/Perl/perl5/commit/5006b450deadfb59170a0e0526f9b350a3721576
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M inline.h

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


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

  Changed paths:
    M locale.c

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


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

  Changed paths:
    M perl.h

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


Compare: https://github.com/Perl/perl5/compare/e42e61a18f7f...3ff60b66cb87



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