Branch: refs/heads/smoke-me/khw-locale
  Home:   https://github.com/Perl/perl5
  Commit: b82275466afde34518d7e724df4ab4248cc66389
      
https://github.com/Perl/perl5/commit/b82275466afde34518d7e724df4ab4248cc66389
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: fa5fab4e8590ab195be55544bf0afdf7be443d10
      
https://github.com/Perl/perl5/commit/fa5fab4e8590ab195be55544bf0afdf7be443d10
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M mg.c

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


  Commit: a334ef355d89bb07986376982d39edc137521c75
      
https://github.com/Perl/perl5/commit/a334ef355d89bb07986376982d39edc137521c75
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M lib/locale_threads.t

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


  Commit: 0777128733789291917603a9db371351f37c1e72
      
https://github.com/Perl/perl5/commit/0777128733789291917603a9db371351f37c1e72
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: ffd870ad70843bdc37d4c6da934606b1e3405285
      
https://github.com/Perl/perl5/commit/ffd870ad70843bdc37d4c6da934606b1e3405285
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 6ad302f8f9c7bf2bca70f2f851d1c025a9732609
      
https://github.com/Perl/perl5/commit/6ad302f8f9c7bf2bca70f2f851d1c025a9732609
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 18207a0f8f5d432b591ffb72f115ced505b7a467
      
https://github.com/Perl/perl5/commit/18207a0f8f5d432b591ffb72f115ced505b7a467
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 5d5222788395ecda89a0f71614d9c252144422ff
      
https://github.com/Perl/perl5/commit/5d5222788395ecda89a0f71614d9c252144422ff
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M handy.h

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


  Commit: 935b5d0ac046713cb75f3d8d5e3560f8f828d0f7
      
https://github.com/Perl/perl5/commit/935b5d0ac046713cb75f3d8d5e3560f8f828d0f7
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 1342eb6e9b8fd5769005d6c4ba8c8751dfa5fffd
      
https://github.com/Perl/perl5/commit/1342eb6e9b8fd5769005d6c4ba8c8751dfa5fffd
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: e34902c93d8ca6270472968f56e9b68262019211
      
https://github.com/Perl/perl5/commit/e34902c93d8ca6270472968f56e9b68262019211
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 544e6da73fd1c1e3311df10d3d944ab0a937f008
      
https://github.com/Perl/perl5/commit/544e6da73fd1c1e3311df10d3d944ab0a937f008
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: c3fffd270d3bc2d669417be690fa0ba9db084085
      
https://github.com/Perl/perl5/commit/c3fffd270d3bc2d669417be690fa0ba9db084085
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: f856bda162a127394f690bc514c12c8444e46aee
      
https://github.com/Perl/perl5/commit/f856bda162a127394f690bc514c12c8444e46aee
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 1459b2f639be7b58fb9bd47770fe01a5811db459
      
https://github.com/Perl/perl5/commit/1459b2f639be7b58fb9bd47770fe01a5811db459
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M locale.c

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


  Commit: 299ccde13e2260a181e07be2decd80b6b3d74583
      
https://github.com/Perl/perl5/commit/299ccde13e2260a181e07be2decd80b6b3d74583
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: a2b1c726f40d2c572f0a916c0adae3f5ef5d774b
      
https://github.com/Perl/perl5/commit/a2b1c726f40d2c572f0a916c0adae3f5ef5d774b
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 8c3b3efe75bd10533bb8df623c90ddd0734f90d9
      
https://github.com/Perl/perl5/commit/8c3b3efe75bd10533bb8df623c90ddd0734f90d9
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 6a8a4408a756d6d8e2bc979721d32c2be0c21438
      
https://github.com/Perl/perl5/commit/6a8a4408a756d6d8e2bc979721d32c2be0c21438
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: b01ba6e51a5486848d89f4babde78c4e34208d1d
      
https://github.com/Perl/perl5/commit/b01ba6e51a5486848d89f4babde78c4e34208d1d
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 45b43e53c839bc135c3b6f54148c3c9cc4afc11f
      
https://github.com/Perl/perl5/commit/45b43e53c839bc135c3b6f54148c3c9cc4afc11f
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 27abeed6cff1c7b2d88ad81c70ed0b8364b0d4e2
      
https://github.com/Perl/perl5/commit/27abeed6cff1c7b2d88ad81c70ed0b8364b0d4e2
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 842e5b375ddbd29769833c31badb440fa6139aa3
      
https://github.com/Perl/perl5/commit/842e5b375ddbd29769833c31badb440fa6139aa3
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: ca7cdb8e73e9a056d09d20c79e7a12288e5cdbe3
      
https://github.com/Perl/perl5/commit/ca7cdb8e73e9a056d09d20c79e7a12288e5cdbe3
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: d42a2bbefcd4f0fcdda249a6465e8f8e0997065a
      
https://github.com/Perl/perl5/commit/d42a2bbefcd4f0fcdda249a6465e8f8e0997065a
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: b36e532cab242b84d8e2033c0bf28e2fb2fcb65a
      
https://github.com/Perl/perl5/commit/b36e532cab242b84d8e2033c0bf28e2fb2fcb65a
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 70b75958aca3d8cc6774480c0a1a206e7dca8ecc
      
https://github.com/Perl/perl5/commit/70b75958aca3d8cc6774480c0a1a206e7dca8ecc
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: a1e84fe3e7b2b4988cc4b3d787a9287030cb161e
      
https://github.com/Perl/perl5/commit/a1e84fe3e7b2b4988cc4b3d787a9287030cb161e
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 7d2c19fa098832e8e72c0e3e39bc9b814dff09e1
      
https://github.com/Perl/perl5/commit/7d2c19fa098832e8e72c0e3e39bc9b814dff09e1
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: e67635978a0b9914a79a21b56b4e45dd107283c7
      
https://github.com/Perl/perl5/commit/e67635978a0b9914a79a21b56b4e45dd107283c7
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: e707d09301695963300ecb4e4e7aab771421093d
      
https://github.com/Perl/perl5/commit/e707d09301695963300ecb4e4e7aab771421093d
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 111fae0b6336065c81010ca597eb2f69fef99bc3
      
https://github.com/Perl/perl5/commit/111fae0b6336065c81010ca597eb2f69fef99bc3
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: b996aa42fcbf9490bf7916f9c6809e28ca8b37ac
      
https://github.com/Perl/perl5/commit/b996aa42fcbf9490bf7916f9c6809e28ca8b37ac
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 98ba5325a10783cc01389f47dfe2b93babc974f2
      
https://github.com/Perl/perl5/commit/98ba5325a10783cc01389f47dfe2b93babc974f2
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 134696a72f7bd9009ade71ad793dad8a712f3533
      
https://github.com/Perl/perl5/commit/134696a72f7bd9009ade71ad793dad8a712f3533
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 6e3b693faab37453059290c711b057094541fce8
      
https://github.com/Perl/perl5/commit/6e3b693faab37453059290c711b057094541fce8
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 539e8b261bb404129e827048ce824d024f55598a
      
https://github.com/Perl/perl5/commit/539e8b261bb404129e827048ce824d024f55598a
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 320d1472c04c7e4e765a6391a3bc9cd62e9e085b
      
https://github.com/Perl/perl5/commit/320d1472c04c7e4e765a6391a3bc9cd62e9e085b
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: deac05c795aa97a7dd55f5dbb51e476614553277
      
https://github.com/Perl/perl5/commit/deac05c795aa97a7dd55f5dbb51e476614553277
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 6e03e80cc96197e7b3537d6dd0b4f6e750bc18f2
      
https://github.com/Perl/perl5/commit/6e03e80cc96197e7b3537d6dd0b4f6e750bc18f2
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: cc3d96f790f941afebd826df318e7c805ad210e8
      
https://github.com/Perl/perl5/commit/cc3d96f790f941afebd826df318e7c805ad210e8
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: afaa5ea9491cfcf6aae55c295d0b2bf312ab5eeb
      
https://github.com/Perl/perl5/commit/afaa5ea9491cfcf6aae55c295d0b2bf312ab5eeb
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 4571adf62cba06d8f4f3938e5d987336898ae528
      
https://github.com/Perl/perl5/commit/4571adf62cba06d8f4f3938e5d987336898ae528
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 4c54e70ff9dceaa39f496749e9d40603660998e9
      
https://github.com/Perl/perl5/commit/4c54e70ff9dceaa39f496749e9d40603660998e9
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 325caa0d148a05910d19c8dcdeb2d0883df8cdce
      
https://github.com/Perl/perl5/commit/325caa0d148a05910d19c8dcdeb2d0883df8cdce
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 2fbee2a8ccfac055f2a279cda0e5f481617edc32
      
https://github.com/Perl/perl5/commit/2fbee2a8ccfac055f2a279cda0e5f481617edc32
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: bcb8499c936240fcb8099831b4f25edcd31bb0fe
      
https://github.com/Perl/perl5/commit/bcb8499c936240fcb8099831b4f25edcd31bb0fe
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: ccc1cae3f1a210b7c02e298b0aa70bb09cf32573
      
https://github.com/Perl/perl5/commit/ccc1cae3f1a210b7c02e298b0aa70bb09cf32573
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: f2711d7eff8b394b9443f747fffa0bed95800ca7
      
https://github.com/Perl/perl5/commit/f2711d7eff8b394b9443f747fffa0bed95800ca7
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: c21dac3ba0f2ba59521b055a8b472b7104102a29
      
https://github.com/Perl/perl5/commit/c21dac3ba0f2ba59521b055a8b472b7104102a29
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: e758145cc46f42ce3ebdf9d2ec6fb6db73bd61e2
      
https://github.com/Perl/perl5/commit/e758145cc46f42ce3ebdf9d2ec6fb6db73bd61e2
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: e4d553646c60b0bdcb5c4e8e57d52e66b4163bb2
      
https://github.com/Perl/perl5/commit/e4d553646c60b0bdcb5c4e8e57d52e66b4163bb2
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 14ca5ece659ea5fbc2bacaf9cf4aeeb7f4bde597
      
https://github.com/Perl/perl5/commit/14ca5ece659ea5fbc2bacaf9cf4aeeb7f4bde597
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: c544221e58fbf8bc1b1944664eb9b35e4c5625f3
      
https://github.com/Perl/perl5/commit/c544221e58fbf8bc1b1944664eb9b35e4c5625f3
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 7f4b2cfaa58767687e85889bfc05c6d5c3d7f09d
      
https://github.com/Perl/perl5/commit/7f4b2cfaa58767687e85889bfc05c6d5c3d7f09d
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M ext/POSIX/POSIX.xs

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

Properly indent some nested preprocessor directives


  Commit: f5a8667e14d0bd91af394e7ac32fc7a3bb711afe
      
https://github.com/Perl/perl5/commit/f5a8667e14d0bd91af394e7ac32fc7a3bb711afe
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: bd1d887021e1e3917ff191b36c5a83bc42272104
      
https://github.com/Perl/perl5/commit/bd1d887021e1e3917ff191b36c5a83bc42272104
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 28a83b397f4edbe681a9ba800afb152e96b26ea0
      
https://github.com/Perl/perl5/commit/28a83b397f4edbe681a9ba800afb152e96b26ea0
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: b5a493364c569a42cfbc73e928e356e44e3f0f70
      
https://github.com/Perl/perl5/commit/b5a493364c569a42cfbc73e928e356e44e3f0f70
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: be2db2cbeb0e80d6eaeb6111f6fb388de1415668
      
https://github.com/Perl/perl5/commit/be2db2cbeb0e80d6eaeb6111f6fb388de1415668
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 1fb75f0f6f67784dc226acd39d976e944bbf2cf0
      
https://github.com/Perl/perl5/commit/1fb75f0f6f67784dc226acd39d976e944bbf2cf0
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 24a0efeeeb56dc673953812ae6528cccb1986da9
      
https://github.com/Perl/perl5/commit/24a0efeeeb56dc673953812ae6528cccb1986da9
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: d9dd6fb55eae9216ae3dd8789ccd36d64440580e
      
https://github.com/Perl/perl5/commit/d9dd6fb55eae9216ae3dd8789ccd36d64440580e
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 4738e2415792f2167b76ee655efece3102415403
      
https://github.com/Perl/perl5/commit/4738e2415792f2167b76ee655efece3102415403
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M locale.c

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

This allows some preprocessor conditionals to be removed


  Commit: 8f926d899852a323f879cf5b7e02fcd6cf793ce7
      
https://github.com/Perl/perl5/commit/8f926d899852a323f879cf5b7e02fcd6cf793ce7
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M locale.c

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

strEQ and && already return booleans


  Commit: 9198a691dbb068fcb5c1095ebc03e397ea59bbfc
      
https://github.com/Perl/perl5/commit/9198a691dbb068fcb5c1095ebc03e397ea59bbfc
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 6c50dab52a282b12eb5168ec73c1fb4280a85ad6
      
https://github.com/Perl/perl5/commit/6c50dab52a282b12eb5168ec73c1fb4280a85ad6
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: ed326c01638f5f8318f1961cfbefcaa604e9e1fd
      
https://github.com/Perl/perl5/commit/ed326c01638f5f8318f1961cfbefcaa604e9e1fd
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: c52b4ada0a9bf884e19986d2a8b4ee73be5382c4
      
https://github.com/Perl/perl5/commit/c52b4ada0a9bf884e19986d2a8b4ee73be5382c4
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: a5e564ddd4317a46e3a84514033c532af90f54bd
      
https://github.com/Perl/perl5/commit/a5e564ddd4317a46e3a84514033c532af90f54bd
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: a8d3a9da0d78c04c5582a02883ada10eef486511
      
https://github.com/Perl/perl5/commit/a8d3a9da0d78c04c5582a02883ada10eef486511
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 70ff40cea466a7913084673d680a6d6a974944c5
      
https://github.com/Perl/perl5/commit/70ff40cea466a7913084673d680a6d6a974944c5
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 197a817a5483081757a416b07840dcddcff99265
      
https://github.com/Perl/perl5/commit/197a817a5483081757a416b07840dcddcff99265
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 99f38a4e202c28b037baed508036c7fbf294bfc1
      
https://github.com/Perl/perl5/commit/99f38a4e202c28b037baed508036c7fbf294bfc1
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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.

If for some unlikely reason this fails, drop down to the existing code
that gets the code page from the locale name.


  Commit: 39bfcb698d00b469268c89acf2af8b9be72246d1
      
https://github.com/Perl/perl5/commit/39bfcb698d00b469268c89acf2af8b9be72246d1
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: e9a0cd8085120e0395adad79510aef4893b60bf6
      
https://github.com/Perl/perl5/commit/e9a0cd8085120e0395adad79510aef4893b60bf6
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: fd1fad1bf2c2e9108c108b866ce197f0ffde83a5
      
https://github.com/Perl/perl5/commit/fd1fad1bf2c2e9108c108b866ce197f0ffde83a5
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 70fb440807d9ef876ac225961d5af71e7df5838f
      
https://github.com/Perl/perl5/commit/70fb440807d9ef876ac225961d5af71e7df5838f
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: f739b0ec148c4465f1084b4d0b5699f2c374ba8e
      
https://github.com/Perl/perl5/commit/f739b0ec148c4465f1084b4d0b5699f2c374ba8e
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 249333651fb4e42de0a4f36041204315d9b696de
      
https://github.com/Perl/perl5/commit/249333651fb4e42de0a4f36041204315d9b696de
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 53f10fe71f7d50ed2776721f6edcd025105abd6d
      
https://github.com/Perl/perl5/commit/53f10fe71f7d50ed2776721f6edcd025105abd6d
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 39d63807d894af891af76d1ca514f2fe15816b31
      
https://github.com/Perl/perl5/commit/39d63807d894af891af76d1ca514f2fe15816b31
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: d786e3c1d9f2756554942fc41876017d080a85d0
      
https://github.com/Perl/perl5/commit/d786e3c1d9f2756554942fc41876017d080a85d0
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 6fc0a0867e5b94694e2b435fb0a41fd3ef3705c9
      
https://github.com/Perl/perl5/commit/6fc0a0867e5b94694e2b435fb0a41fd3ef3705c9
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: ea322f5354b15061a5029d63f17c9950e8e741b3
      
https://github.com/Perl/perl5/commit/ea322f5354b15061a5029d63f17c9950e8e741b3
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 5deaaa5fe08e5be31a9eaf9da22006525cb876e2
      
https://github.com/Perl/perl5/commit/5deaaa5fe08e5be31a9eaf9da22006525cb876e2
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: db5b6b357505efbc8f8e79947eae54904fb3529c
      
https://github.com/Perl/perl5/commit/db5b6b357505efbc8f8e79947eae54904fb3529c
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M locale.c

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


  Commit: 6818cebdc75cc73f74546b27b0a1cf6f39c45ed3
      
https://github.com/Perl/perl5/commit/6818cebdc75cc73f74546b27b0a1cf6f39c45ed3
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 8986743e27ff6f1f31183ca54d6bde28a0376e35
      
https://github.com/Perl/perl5/commit/8986743e27ff6f1f31183ca54d6bde28a0376e35
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 414cc5ac574830d1f4a2c2a98800619cf81f2a83
      
https://github.com/Perl/perl5/commit/414cc5ac574830d1f4a2c2a98800619cf81f2a83
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    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: 1bdddd7252225e64ad1ddb11aa38935e27edf2c6
      
https://github.com/Perl/perl5/commit/1bdddd7252225e64ad1ddb11aa38935e27edf2c6
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M mg.c

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

Indent newly formed block from the previous commit.


  Commit: bc65e542423398e8576f5c65f4b86d32b9c4c66a
      
https://github.com/Perl/perl5/commit/bc65e542423398e8576f5c65f4b86d32b9c4c66a
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 13f0853fde4eae73b786fcc590ae297c92048e6c
      
https://github.com/Perl/perl5/commit/13f0853fde4eae73b786fcc590ae297c92048e6c
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 135afc61c34fcc0be76fa6b0202551d2a73c31cb
      
https://github.com/Perl/perl5/commit/135afc61c34fcc0be76fa6b0202551d2a73c31cb
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

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

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

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


  Commit: 655a2bf2275b00d64540dc3e0b7ad5ce827fd4e7
      
https://github.com/Perl/perl5/commit/655a2bf2275b00d64540dc3e0b7ad5ce827fd4e7
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 5c061ea4375a95f796e3e76cc8a676222c2b275a
      
https://github.com/Perl/perl5/commit/5c061ea4375a95f796e3e76cc8a676222c2b275a
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 689fe562f3a2195612cbbf07f47b7cc36726cb53
      
https://github.com/Perl/perl5/commit/689fe562f3a2195612cbbf07f47b7cc36726cb53
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: b51d0022cf0dabe5602c35998f3814f2fd9dc619
      
https://github.com/Perl/perl5/commit/b51d0022cf0dabe5602c35998f3814f2fd9dc619
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 031f381012aea6acecfec2f515cd08cdf6c0a234
      
https://github.com/Perl/perl5/commit/031f381012aea6acecfec2f515cd08cdf6c0a234
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 2f0f065992685b73809bd6ee80732f9dd6660c29
      
https://github.com/Perl/perl5/commit/2f0f065992685b73809bd6ee80732f9dd6660c29
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 895517dca52461555ba715941465e4b36d98de0d
      
https://github.com/Perl/perl5/commit/895517dca52461555ba715941465e4b36d98de0d
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 8e29d2902a26158bffb2f2b85d9d1f900588758d
      
https://github.com/Perl/perl5/commit/8e29d2902a26158bffb2f2b85d9d1f900588758d
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 5fdb438ea54cfcbe79805971b2c63bab806494e9
      
https://github.com/Perl/perl5/commit/5fdb438ea54cfcbe79805971b2c63bab806494e9
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 0eaf03560372e587a4af83b6898c9c4f8905c50a
      
https://github.com/Perl/perl5/commit/0eaf03560372e587a4af83b6898c9c4f8905c50a
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M locale.c

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


  Commit: e32f96f30bda617c6df54e9182009500d12d2b85
      
https://github.com/Perl/perl5/commit/e32f96f30bda617c6df54e9182009500d12d2b85
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 267bd1d68a7852147ddb8b42464139dc8f9e7a42
      
https://github.com/Perl/perl5/commit/267bd1d68a7852147ddb8b42464139dc8f9e7a42
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: c726fae387050b0cc6429b7b9abfeb39ca674a3c
      
https://github.com/Perl/perl5/commit/c726fae387050b0cc6429b7b9abfeb39ca674a3c
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: c757c3799a0c2c4a2e467b29e9a19ae261ff8194
      
https://github.com/Perl/perl5/commit/c757c3799a0c2c4a2e467b29e9a19ae261ff8194
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M locale.c

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


  Commit: 8f4e4d5a46cca43141afebe1658013f5343377d6
      
https://github.com/Perl/perl5/commit/8f4e4d5a46cca43141afebe1658013f5343377d6
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 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: 43dfe97843ee0c7c751a896edb037406c391630d
      
https://github.com/Perl/perl5/commit/43dfe97843ee0c7c751a896edb037406c391630d
  Author: Karl Williamson <[email protected]>
  Date:   2021-03-04 (Thu, 04 Mar 2021)

  Changed paths:
    M perl.h

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

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


Compare: https://github.com/Perl/perl5/compare/d9cd036bc16e...43dfe97843ee

Reply via email to