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

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

From:
Karl Williamson via perl5-changes
Date:
March 11, 2021 01:53
Subject:
[Perl/perl5] aec4c1: Add ability to easily add info to DEBUG output
Message ID:
Perl/perl5/push/refs/heads/smoke-me/khw-locale/cc1997-e42e61@github.com
  Branch: refs/heads/smoke-me/khw-locale
  Home:   https://github.com/Perl/perl5
  Commit: aec4c165d382048387cea26f71cfcaf012d04cf5
      https://github.com/Perl/perl5/commit/aec4c165d382048387cea26f71cfcaf012d04cf5
  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: 7debd271b43bd3b1bed826f1d4cf0869ae265eb4
      https://github.com/Perl/perl5/commit/7debd271b43bd3b1bed826f1d4cf0869ae265eb4
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M intrpvar.h

  Log Message:
  -----------
  intrpvar.h: Add clarifying comment


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

  Changed paths:
    M perl.h

  Log Message:
  -----------
  perl.h: Clarify debugging msg for locales

I wrote this years ago, and now have discovered it was written
assuming the consumer is more familiar with the underlying code than
warranted.


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

  Changed paths:
    M cygwin/cygwin.c

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


  Commit: 55fb2b61c9fdebc67b97b7cbc14fd1cb0488824a
      https://github.com/Perl/perl5/commit/55fb2b61c9fdebc67b97b7cbc14fd1cb0488824a
  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: 06e3bbfcf95b4c5c776962e09d553bcd8b062111
      https://github.com/Perl/perl5/commit/06e3bbfcf95b4c5c776962e09d553bcd8b062111
  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: 9a90229b624409d79c3990500779cf68b0b56c30
      https://github.com/Perl/perl5/commit/9a90229b624409d79c3990500779cf68b0b56c30
  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: d333da66f6e64ead938c6642ff4a468bd4c28ad8
      https://github.com/Perl/perl5/commit/d333da66f6e64ead938c6642ff4a468bd4c28ad8
  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: b081c6756a59084ce87cfb9209a4c8219593c605
      https://github.com/Perl/perl5/commit/b081c6756a59084ce87cfb9209a4c8219593c605
  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: 365f32f5581815f50228d922bc469029bae57ef7
      https://github.com/Perl/perl5/commit/365f32f5581815f50228d922bc469029bae57ef7
  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: a2578a360c7b57eda471c6753d2cbb82394756da
      https://github.com/Perl/perl5/commit/a2578a360c7b57eda471c6753d2cbb82394756da
  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: f49ad109aa3ab4aaf52e33e0b6d0371279ecd125
      https://github.com/Perl/perl5/commit/f49ad109aa3ab4aaf52e33e0b6d0371279ecd125
  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: 13faa4bf3bcf9efdb8ea05ce907b1a544ab2bb86
      https://github.com/Perl/perl5/commit/13faa4bf3bcf9efdb8ea05ce907b1a544ab2bb86
  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: d6bbe2915c73da50f2867fc040a62963d7e7237f
      https://github.com/Perl/perl5/commit/d6bbe2915c73da50f2867fc040a62963d7e7237f
  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: 2941987025d91ae129d19ff5a78d649beffcc273
      https://github.com/Perl/perl5/commit/2941987025d91ae129d19ff5a78d649beffcc273
  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: 11b1c0b10a640b69ac8e8af024edb6d4d8724f38
      https://github.com/Perl/perl5/commit/11b1c0b10a640b69ac8e8af024edb6d4d8724f38
  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: d553e8a4237187f371bd2487e2a981f704a7e559
      https://github.com/Perl/perl5/commit/d553e8a4237187f371bd2487e2a981f704a7e559
  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: 63f356e8076893ec5d1d415cfcbfb1d23bb44507
      https://github.com/Perl/perl5/commit/63f356e8076893ec5d1d415cfcbfb1d23bb44507
  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: 6e04aa53849f6a40c829cb9467d187182028583d
      https://github.com/Perl/perl5/commit/6e04aa53849f6a40c829cb9467d187182028583d
  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: 50123d8b8f5208079bd78f7ee974093356dffc8c
      https://github.com/Perl/perl5/commit/50123d8b8f5208079bd78f7ee974093356dffc8c
  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: bdc0b2a19a9c5ee1f6eaa64e5ef67487c5df6aa7
      https://github.com/Perl/perl5/commit/bdc0b2a19a9c5ee1f6eaa64e5ef67487c5df6aa7
  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: 682757a7eaa59b54b53a127508a2a1d4099f30f3
      https://github.com/Perl/perl5/commit/682757a7eaa59b54b53a127508a2a1d4099f30f3
  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: 617d52a3ac5dceb51000a1951b70d858ef9985f2
      https://github.com/Perl/perl5/commit/617d52a3ac5dceb51000a1951b70d858ef9985f2
  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: 918410f572e0521ed64710b82c17a59afbcd91cb
      https://github.com/Perl/perl5/commit/918410f572e0521ed64710b82c17a59afbcd91cb
  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: 5d3267db023e2279d6d503736dcb36f30d2ebbfa
      https://github.com/Perl/perl5/commit/5d3267db023e2279d6d503736dcb36f30d2ebbfa
  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: caa170aafed9862e6e8115441dcf467479d6257e
      https://github.com/Perl/perl5/commit/caa170aafed9862e6e8115441dcf467479d6257e
  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: 13217796ccae078326ecbc057db38942163ed160
      https://github.com/Perl/perl5/commit/13217796ccae078326ecbc057db38942163ed160
  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: ad8b7da4902a52e01061d346f73edc8039b42b7e
      https://github.com/Perl/perl5/commit/ad8b7da4902a52e01061d346f73edc8039b42b7e
  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: 488aaf634b112c62b2eb980937109a7770fd4c95
      https://github.com/Perl/perl5/commit/488aaf634b112c62b2eb980937109a7770fd4c95
  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: b8cb9b25521d0a09cce3f79667f05209b6d754a3
      https://github.com/Perl/perl5/commit/b8cb9b25521d0a09cce3f79667f05209b6d754a3
  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: dce2fe077cf3ffc32db66566536d9afa1759d328
      https://github.com/Perl/perl5/commit/dce2fe077cf3ffc32db66566536d9afa1759d328
  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: eaf17c7253e62e022741c5004e25a1651f79a00f
      https://github.com/Perl/perl5/commit/eaf17c7253e62e022741c5004e25a1651f79a00f
  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: d4d4a0fb6540e1841ef753243e46b2ea21a37688
      https://github.com/Perl/perl5/commit/d4d4a0fb6540e1841ef753243e46b2ea21a37688
  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: 8d791610b656d33eb838547999a8604c0bef5e95
      https://github.com/Perl/perl5/commit/8d791610b656d33eb838547999a8604c0bef5e95
  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: 5abf75ac0155c7630433b460579036296c81602f
      https://github.com/Perl/perl5/commit/5abf75ac0155c7630433b460579036296c81602f
  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: dc1966de2ab60618ce3788daaa07970740901d9d
      https://github.com/Perl/perl5/commit/dc1966de2ab60618ce3788daaa07970740901d9d
  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: bdc7a70c4e040e8e2d2f62201e2dc3a083e32286
      https://github.com/Perl/perl5/commit/bdc7a70c4e040e8e2d2f62201e2dc3a083e32286
  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: a68f7f73f3d93c588d54de977f16622a63510b04
      https://github.com/Perl/perl5/commit/a68f7f73f3d93c588d54de977f16622a63510b04
  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: 607d7cff721211089f96cce54cd221f71d5815e6
      https://github.com/Perl/perl5/commit/607d7cff721211089f96cce54cd221f71d5815e6
  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: eb49797aa01ad5deeeec0c865007c72e40fc9f5c
      https://github.com/Perl/perl5/commit/eb49797aa01ad5deeeec0c865007c72e40fc9f5c
  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: 74dce75a534ba213b151f5899ae835014ae1ab33
      https://github.com/Perl/perl5/commit/74dce75a534ba213b151f5899ae835014ae1ab33
  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: c75977aa195f75a0b22b8fb56b6a0d6e39efdc1c
      https://github.com/Perl/perl5/commit/c75977aa195f75a0b22b8fb56b6a0d6e39efdc1c
  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: 4bf8f1003e9f038bcbd778db371d0ee046a620a9
      https://github.com/Perl/perl5/commit/4bf8f1003e9f038bcbd778db371d0ee046a620a9
  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: a1c0b4a818770bf371c2246d11db57c74d32ca23
      https://github.com/Perl/perl5/commit/a1c0b4a818770bf371c2246d11db57c74d32ca23
  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: 6ad8b059a7bc8ed3ec072f3cab3f806ffe7a402f
      https://github.com/Perl/perl5/commit/6ad8b059a7bc8ed3ec072f3cab3f806ffe7a402f
  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: 2e43094b9d79044fda42bc3bac44a74b456c7c5f
      https://github.com/Perl/perl5/commit/2e43094b9d79044fda42bc3bac44a74b456c7c5f
  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: 2f96c45f6151f008a2bbf18d8ac913dafbf227b4
      https://github.com/Perl/perl5/commit/2f96c45f6151f008a2bbf18d8ac913dafbf227b4
  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: b4482b3dfbf2ba7f306244061998479874ccdc7c
      https://github.com/Perl/perl5/commit/b4482b3dfbf2ba7f306244061998479874ccdc7c
  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: 907a2686dff12ea070ca0b841c3341f6fd59beab
      https://github.com/Perl/perl5/commit/907a2686dff12ea070ca0b841c3341f6fd59beab
  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: 713b45264c0ef1d0b9abb1894df34b96c2d87582
      https://github.com/Perl/perl5/commit/713b45264c0ef1d0b9abb1894df34b96c2d87582
  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: 34dc16b63687e0b7599b1fe76161ce1f5a2c701b
      https://github.com/Perl/perl5/commit/34dc16b63687e0b7599b1fe76161ce1f5a2c701b
  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: 559ae7e02f771b6f33c60349ce2a5b8fcec1d7b4
      https://github.com/Perl/perl5/commit/559ae7e02f771b6f33c60349ce2a5b8fcec1d7b4
  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: 0d8b74d874e7362f3fa341302056ab28eaf21a98
      https://github.com/Perl/perl5/commit/0d8b74d874e7362f3fa341302056ab28eaf21a98
  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: dc3e6e78061e17156890d071a77c0460efbe8a17
      https://github.com/Perl/perl5/commit/dc3e6e78061e17156890d071a77c0460efbe8a17
  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: 4ca43394ae0ddae3472cf4caebbcd91019cb4ecc
      https://github.com/Perl/perl5/commit/4ca43394ae0ddae3472cf4caebbcd91019cb4ecc
  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: 5c8ba1aeeed23374461a4a14bca880d2df5dae2a
      https://github.com/Perl/perl5/commit/5c8ba1aeeed23374461a4a14bca880d2df5dae2a
  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: 2eacf328ba20bb718fce0c768c3ad4a4918aba95
      https://github.com/Perl/perl5/commit/2eacf328ba20bb718fce0c768c3ad4a4918aba95
  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: 5c56c9bb10f5a74f659a475171121c17ef6c6f54
      https://github.com/Perl/perl5/commit/5c56c9bb10f5a74f659a475171121c17ef6c6f54
  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: 9165c1c3f19223bd26d2e7e277466470695e59e4
      https://github.com/Perl/perl5/commit/9165c1c3f19223bd26d2e7e277466470695e59e4
  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: 6601a5dd983d75ff14773a8fdcced9adca8f054d
      https://github.com/Perl/perl5/commit/6601a5dd983d75ff14773a8fdcced9adca8f054d
  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: ad7e41b394b4e2a873037679b91f5ad2ca926ef4
      https://github.com/Perl/perl5/commit/ad7e41b394b4e2a873037679b91f5ad2ca926ef4
  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: b18331f268a5e00e6bc39399fe3c3ef2fd67c24a
      https://github.com/Perl/perl5/commit/b18331f268a5e00e6bc39399fe3c3ef2fd67c24a
  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: cfa45632fc969af19c26fbd5c15b35146b0fa1a4
      https://github.com/Perl/perl5/commit/cfa45632fc969af19c26fbd5c15b35146b0fa1a4
  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: f93f381d0bf15c82b6c754519626d44c261eb952
      https://github.com/Perl/perl5/commit/f93f381d0bf15c82b6c754519626d44c261eb952
  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: d3d3f731974f9660aac12ae09cff0f016f1968eb
      https://github.com/Perl/perl5/commit/d3d3f731974f9660aac12ae09cff0f016f1968eb
  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: 3f2c1d40065dd2fb79821c55b1f8296fd0fa7e9a
      https://github.com/Perl/perl5/commit/3f2c1d40065dd2fb79821c55b1f8296fd0fa7e9a
  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: 8ec38af3b2ad4bb71b54ef781b5a7d05d41cd36c
      https://github.com/Perl/perl5/commit/8ec38af3b2ad4bb71b54ef781b5a7d05d41cd36c
  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: bf379e8057cc7a9d9fd6afbddb6b6d18154fd443
      https://github.com/Perl/perl5/commit/bf379e8057cc7a9d9fd6afbddb6b6d18154fd443
  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: 2874c6079c024a78469aed76a91b65debb92494a
      https://github.com/Perl/perl5/commit/2874c6079c024a78469aed76a91b65debb92494a
  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: 5c9f33cec4a36502ac97f59438e62c5bdee59003
      https://github.com/Perl/perl5/commit/5c9f33cec4a36502ac97f59438e62c5bdee59003
  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: 7a129a80a859c37902e959120ed259fdf9aff8e1
      https://github.com/Perl/perl5/commit/7a129a80a859c37902e959120ed259fdf9aff8e1
  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: 0f1cffcc7b76ea23febe61de79454367c7c32d3f
      https://github.com/Perl/perl5/commit/0f1cffcc7b76ea23febe61de79454367c7c32d3f
  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: d8283ff461265897243cb66ef67acb5d19c9e44e
      https://github.com/Perl/perl5/commit/d8283ff461265897243cb66ef67acb5d19c9e44e
  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: abfe8576f5dc6d9a07df9f951927720cfe584ded
      https://github.com/Perl/perl5/commit/abfe8576f5dc6d9a07df9f951927720cfe584ded
  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: 7258905fd08e9cfbd024cec6e686b47c14e573fb
      https://github.com/Perl/perl5/commit/7258905fd08e9cfbd024cec6e686b47c14e573fb
  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: d4a0bec455402a6a896f8ae8a9ab0380f519e508
      https://github.com/Perl/perl5/commit/d4a0bec455402a6a896f8ae8a9ab0380f519e508
  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: 65312c90e2e3e9262763ed5ad2bbc42d4c263993
      https://github.com/Perl/perl5/commit/65312c90e2e3e9262763ed5ad2bbc42d4c263993
  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: ea650cec5d925fbca4273f7f6dbdeae2cb2ee46a
      https://github.com/Perl/perl5/commit/ea650cec5d925fbca4273f7f6dbdeae2cb2ee46a
  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: 3c561a7899cd07ff077ee21eb164dc20fba9c050
      https://github.com/Perl/perl5/commit/3c561a7899cd07ff077ee21eb164dc20fba9c050
  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: d314be03df2a71dedd6ded43cf3d09111ff7dde4
      https://github.com/Perl/perl5/commit/d314be03df2a71dedd6ded43cf3d09111ff7dde4
  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: ac5025fa30cdc8c9571d0a8a3930da25016eabdf
      https://github.com/Perl/perl5/commit/ac5025fa30cdc8c9571d0a8a3930da25016eabdf
  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: 07683e7aa262701b47086e730d9297aa7ce58f6b
      https://github.com/Perl/perl5/commit/07683e7aa262701b47086e730d9297aa7ce58f6b
  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: 3ce77aeed3902967511796c3e97bdbd551520f14
      https://github.com/Perl/perl5/commit/3ce77aeed3902967511796c3e97bdbd551520f14
  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: 33ab5dda73521024bf2e64d8ea64b82cf67922cf
      https://github.com/Perl/perl5/commit/33ab5dda73521024bf2e64d8ea64b82cf67922cf
  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: f247ab1e1e984eb09699775dbf98d6574ca97dd0
      https://github.com/Perl/perl5/commit/f247ab1e1e984eb09699775dbf98d6574ca97dd0
  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: f36f87c0e4f4684d469e6f60ebd4b4900f43938c
      https://github.com/Perl/perl5/commit/f36f87c0e4f4684d469e6f60ebd4b4900f43938c
  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: bcf8a0a4bbaae9e73366a887eea313b6cf677b6b
      https://github.com/Perl/perl5/commit/bcf8a0a4bbaae9e73366a887eea313b6cf677b6b
  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: 392a2f109cbf8896e33749aab00ac7b6caae850a
      https://github.com/Perl/perl5/commit/392a2f109cbf8896e33749aab00ac7b6caae850a
  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: ffbb40bc21f22721390415cf736f61cc38ccf64d
      https://github.com/Perl/perl5/commit/ffbb40bc21f22721390415cf736f61cc38ccf64d
  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: df44d004fb3a17da97df150d4aa012492aa0f6d7
      https://github.com/Perl/perl5/commit/df44d004fb3a17da97df150d4aa012492aa0f6d7
  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: 8228ca9cdfabdcbdb55812abd4990fb843e3c351
      https://github.com/Perl/perl5/commit/8228ca9cdfabdcbdb55812abd4990fb843e3c351
  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: 0f5adb3eced5c2ae53f66f08725d60bd16d9279e
      https://github.com/Perl/perl5/commit/0f5adb3eced5c2ae53f66f08725d60bd16d9279e
  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: e3ae3e92e9ffec7add0cbfbd7edb57167cd0178e
      https://github.com/Perl/perl5/commit/e3ae3e92e9ffec7add0cbfbd7edb57167cd0178e
  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: 5582ac4be2767173d0cd0a389fd651ddabb98849
      https://github.com/Perl/perl5/commit/5582ac4be2767173d0cd0a389fd651ddabb98849
  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: 511b12ab6eebf108e666d2a9cb628a33959917ba
      https://github.com/Perl/perl5/commit/511b12ab6eebf108e666d2a9cb628a33959917ba
  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: fb624280cf51261ad52e24866d4047400135b4e8
      https://github.com/Perl/perl5/commit/fb624280cf51261ad52e24866d4047400135b4e8
  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: 74de2f4e4a31a170c42f3061f8b58b845974924f
      https://github.com/Perl/perl5/commit/74de2f4e4a31a170c42f3061f8b58b845974924f
  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: 3011b6f93091122a027f59c6b22d01fbef6b59b0
      https://github.com/Perl/perl5/commit/3011b6f93091122a027f59c6b22d01fbef6b59b0
  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: 3a1907add4dc0715292de647f4cc18a25f10787c
      https://github.com/Perl/perl5/commit/3a1907add4dc0715292de647f4cc18a25f10787c
  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: 8283ab6f64e672a538668f057855eaa0d948bc0a
      https://github.com/Perl/perl5/commit/8283ab6f64e672a538668f057855eaa0d948bc0a
  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: d921c53c22b10a6711a423f914371a584053f161
      https://github.com/Perl/perl5/commit/d921c53c22b10a6711a423f914371a584053f161
  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: fc6a5906f83ed68827dcc1a8c1a7aefe0697adf1
      https://github.com/Perl/perl5/commit/fc6a5906f83ed68827dcc1a8c1a7aefe0697adf1
  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: d5f2dcc51a69b8215285b2bded3f1e2c6e607611
      https://github.com/Perl/perl5/commit/d5f2dcc51a69b8215285b2bded3f1e2c6e607611
  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: 4d1125ed577f269589a7524b67efcde3888ba3ed
      https://github.com/Perl/perl5/commit/4d1125ed577f269589a7524b67efcde3888ba3ed
  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: bcbafc50bf974ac5511e6e2c90ab532175450fa7
      https://github.com/Perl/perl5/commit/bcbafc50bf974ac5511e6e2c90ab532175450fa7
  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: 69f217b138db10d8eb4d0161b340158a7bd8aba3
      https://github.com/Perl/perl5/commit/69f217b138db10d8eb4d0161b340158a7bd8aba3
  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: 28b78e1b317b594a34d14fb7fc519a197c0b7eb5
      https://github.com/Perl/perl5/commit/28b78e1b317b594a34d14fb7fc519a197c0b7eb5
  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: fb530aa8cdb07206652c779d450fa146878dff2d
      https://github.com/Perl/perl5/commit/fb530aa8cdb07206652c779d450fa146878dff2d
  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: aa8d6a8157c705fa4e0453be80127c16be0bbab5
      https://github.com/Perl/perl5/commit/aa8d6a8157c705fa4e0453be80127c16be0bbab5
  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: a378457eefc16fc0fb053ff22af42886c642c37d
      https://github.com/Perl/perl5/commit/a378457eefc16fc0fb053ff22af42886c642c37d
  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: bac08116d74f8d0e3d9f9e584eff6e35a5ae0708
      https://github.com/Perl/perl5/commit/bac08116d74f8d0e3d9f9e584eff6e35a5ae0708
  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: 096ea6b44a9c8dd0a076984fb864b5ffb912f4a2
      https://github.com/Perl/perl5/commit/096ea6b44a9c8dd0a076984fb864b5ffb912f4a2
  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: 9053460afc53b9df85f8779e5c8c2a88c666488e
      https://github.com/Perl/perl5/commit/9053460afc53b9df85f8779e5c8c2a88c666488e
  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: 511157d79b8283709c56233a7f096c1ff1d3c48d
      https://github.com/Perl/perl5/commit/511157d79b8283709c56233a7f096c1ff1d3c48d
  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: 6fbe0551d3692d33b5a0610381fd09bba207cc89
      https://github.com/Perl/perl5/commit/6fbe0551d3692d33b5a0610381fd09bba207cc89
  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: 1db5421d3365c7164f11d469ee8f15dae60687d2
      https://github.com/Perl/perl5/commit/1db5421d3365c7164f11d469ee8f15dae60687d2
  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: db21c39c88f9be35c5eec144dce7089405e1ecbf
      https://github.com/Perl/perl5/commit/db21c39c88f9be35c5eec144dce7089405e1ecbf
  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: 43ffd0686be632d89efa2d439911ab4ace1693a5
      https://github.com/Perl/perl5/commit/43ffd0686be632d89efa2d439911ab4ace1693a5
  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: 32272dad26cb2f3ad691cd0c39b22f3aea055146
      https://github.com/Perl/perl5/commit/32272dad26cb2f3ad691cd0c39b22f3aea055146
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

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


  Commit: f67650be6773b3da8441094a2d900e0f18983afd
      https://github.com/Perl/perl5/commit/f67650be6773b3da8441094a2d900e0f18983afd
  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: 8949a4a49849d36cb4178b5717735e706e23505d
      https://github.com/Perl/perl5/commit/8949a4a49849d36cb4178b5717735e706e23505d
  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: 0fa164ff8bfdea2b4d195e51383a8da079f33faf
      https://github.com/Perl/perl5/commit/0fa164ff8bfdea2b4d195e51383a8da079f33faf
  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: fb90577818103b2c2ae2a0adf26fa558fe5dd8ed
      https://github.com/Perl/perl5/commit/fb90577818103b2c2ae2a0adf26fa558fe5dd8ed
  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: 166a001d045a9cfc185b0aa08aafa725a55767aa
      https://github.com/Perl/perl5/commit/166a001d045a9cfc185b0aa08aafa725a55767aa
  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: f38473712387264aa2cf4f0a976d47fc5033102b
      https://github.com/Perl/perl5/commit/f38473712387264aa2cf4f0a976d47fc5033102b
  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: 30585a1d91f5702100659f96eda830020840b04c
      https://github.com/Perl/perl5/commit/30585a1d91f5702100659f96eda830020840b04c
  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: beed849d1140645e1835b1304ab5864746a774c9
      https://github.com/Perl/perl5/commit/beed849d1140645e1835b1304ab5864746a774c9
  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: e82b5996f9e72cc87ac60569e8af4384102cce39
      https://github.com/Perl/perl5/commit/e82b5996f9e72cc87ac60569e8af4384102cce39
  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: b3cb326a5c4fb388bfba3a7c47ebc116c205c5e1
      https://github.com/Perl/perl5/commit/b3cb326a5c4fb388bfba3a7c47ebc116c205c5e1
  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: ab9d322f30517eb3bae3a15e810a08b607daae00
      https://github.com/Perl/perl5/commit/ab9d322f30517eb3bae3a15e810a08b607daae00
  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: 4370ca2532a5e3df3668c13551fbdc8ca46926c6
      https://github.com/Perl/perl5/commit/4370ca2532a5e3df3668c13551fbdc8ca46926c6
  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: bc0f50a3b9f55f1b7271c13212faa57eed210c45
      https://github.com/Perl/perl5/commit/bc0f50a3b9f55f1b7271c13212faa57eed210c45
  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: 4fd0390186074800755c76109cdd0e8e386a0788
      https://github.com/Perl/perl5/commit/4fd0390186074800755c76109cdd0e8e386a0788
  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: ce80ca94ca1dc3eed2c7368ff435c75d658f4820
      https://github.com/Perl/perl5/commit/ce80ca94ca1dc3eed2c7368ff435c75d658f4820
  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: 026542f746885c344810b43760af1dff3ba0f1e5
      https://github.com/Perl/perl5/commit/026542f746885c344810b43760af1dff3ba0f1e5
  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: f8ae8ca3d3f01be69a498348a37010d1292f2f97
      https://github.com/Perl/perl5/commit/f8ae8ca3d3f01be69a498348a37010d1292f2f97
  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: be10103f2a400b86f2237fac48febba5848a3bd6
      https://github.com/Perl/perl5/commit/be10103f2a400b86f2237fac48febba5848a3bd6
  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: e42e61a18f7f46e03a61347dc32cdc1e60b778c9
      https://github.com/Perl/perl5/commit/e42e61a18f7f46e03a61347dc32cdc1e60b778c9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-03-10 (Wed, 10 Mar 2021)

  Changed paths:
    M locale.c

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


Compare: https://github.com/Perl/perl5/compare/cc1997aeb18a...e42e61a18f7f



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