[Perl/perl5] 0b60db: locale.c: Avoid some locale switching

2023-12-20 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 0b60dbbe529b372662069aaadf3dfcf18f85c1cc
  
https://github.com/Perl/perl5/commit/0b60dbbe529b372662069aaadf3dfcf18f85c1cc
  Author: Karl Williamson 
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Avoid some locale switching

In our emulation of nl_langinfo(), prior to this commit, we always
toggled the locales of two categories to the necessary ones.  But it
turns out that some paths through the code don't require this toggling.
This commit narrows the scope of the toggling to just those cases that
need it.




[Perl/perl5] d4848f: `perllol`: Remove indirect object syntax in `Dumpv...

2023-12-20 Thread Elvin Aslanov via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: d4848fd82e6315566c33a1110bad19c1e9f58e45
  
https://github.com/Perl/perl5/commit/d4848fd82e6315566c33a1110bad19c1e9f58e45
  Author: rwp0 
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
M pod/perllol.pod
M pod/perlobj.pod

  Log Message:
  ---
  `perllol`: Remove indirect object syntax in `Dumpvalue` example

Fix `dumpValue` method call syntax as well.

Change the variable name to `$prettify`
because the adverb doesn't make sense
without the indirect syntax.

The documentation shows correct examples:

https://perldoc.perl.org/Dumpvalue




[Perl/perl5] f31cc9: locale.c: Improve comment wording

2023-12-20 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: f31cc9101d969becea07a7ff011c9dfe37f437e1
  
https://github.com/Perl/perl5/commit/f31cc9101d969becea07a7ff011c9dfe37f437e1
  Author: Karl Williamson 
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Improve comment wording




[Perl/perl5] 33ab53: perlapi: Clarify a word in my_strftime() pod

2023-12-20 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 33ab53e5c0fa403470977e42a0b959b685b8e377
  
https://github.com/Perl/perl5/commit/33ab53e5c0fa403470977e42a0b959b685b8e377
  Author: Karl Williamson 
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
M locale.c

  Log Message:
  ---
  perlapi: Clarify a word in my_strftime() pod




[Perl/perl5] e2b6b0: Fallback to use BitScan(Forward|Reverse) on MingW

2023-12-20 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: e2b6b05ee153b1f2dad24d3b736a6ea974780183
  
https://github.com/Perl/perl5/commit/e2b6b05ee153b1f2dad24d3b736a6ea974780183
  Author: Karl Williamson 
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
M inline.h

  Log Message:
  ---
  Fallback to use BitScan(Forward|Reverse) on MingW

Perl has functions that return the positions of the least or most
significant one bit in a word.  gcc has builtins that do these specific
operations, and they get compiled to a single instruction on many
hardware platforms.  Windows instead has various BitScan functions that
do the same thing.

MingW has both gcc and Windows, so it should have access to both the
builtins and to the BitScan functions, but prior to this commit, if we
didn't find gcc builtins on MingW, we wouldn't bother to look for the
BitScan functions.

Reading the code caused me to pause to try to figure out why not use
these BitScan functions, and asked on #irc.  The answer from @xenu was
that on MingW (as opposed to MSVC) they're emulated, and not as
efficient as the gcc builtins.

Then I looked at the code again, and realized we don't try them unless
the gcc builtins aren't available, unlikely these days.  But we should
do something so that people who read this code in the future don't also
end up spending time unnecessarily wondering why we treat MingW
specially.

We could add a comment, but it seems to me better to just not make MingW
a special case.  It's likely that the MingW emulation of the BitScan
functions is better than our further fallback, so I see that as better
and cleaner than special casing MingW.




[Perl/perl5] e622e0: hints/openbsd: All categories but LC_CTYPE are C only

2023-12-20 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: e622e0481be0f2f9c90b85d58a1395bf8945aad8
  
https://github.com/Perl/perl5/commit/e622e0481be0f2f9c90b85d58a1395bf8945aad8
  Author: Karl Williamson 
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
M hints/openbsd.sh

  Log Message:
  ---
  hints/openbsd: All categories but LC_CTYPE are C only

OpenBSD has a deliberately crippled locale system.  The documented
reason is trading this capability for extra security.  As a result, all
locale categories except LC_CTYPE are kept in the C locale, and libc
ignores all attempts to change them.

Perl can be configured to ignore any attempts to change any particular
category.  Doing this results in the more generalized code paths not
getting compiled, so what remains is smaller and runs faster.  This
commit does that for this platform.


  Commit: cfbcdce7a695b2a68e6c005d2f63a05861927555
  
https://github.com/Perl/perl5/commit/cfbcdce7a695b2a68e6c005d2f63a05861927555
  Author: Karl Williamson 
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
M hints/openbsd.sh

  Log Message:
  ---
  OpenBSD properly handles mismatched LC_CTYPE

Perl has code that is conditionally compiled for platforms that have
trouble when LC_CTYPE doesn't match LC_TIME, for example, leading to
mojibake.

Some platforms handles this properly without perl having to deal with
it, and on those, the code is not compiled.

OpenBSD is such a platform, though it's because LC_TIME and all the
other categories only return ASCII, which is compatible with the two
possible LC_CTYPE locales, "C" and "C.UTF-8".

Might as well not compile the more general handling.


Compare: https://github.com/Perl/perl5/compare/3dd0f012b8ee...cfbcdce7a695


[Perl/perl5] 3dd0f0: locale.c: Move code to a separate function

2023-12-20 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 3dd0f012b8ee115b0a649421977e2548196a477a
  
https://github.com/Perl/perl5/commit/3dd0f012b8ee115b0a649421977e2548196a477a
  Author: Karl Williamson 
  Date:   2023-12-20 (Wed, 20 Dec 2023)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Move code to a separate function

Preprocessor directives will likely cause this code to be skipped and
not compiled on modern libc's.  It is a fallback to when there is no
mbtowc() nor mbrtowc() available on the platform, both C99 functions.

But, we've had too many examples of buggy libc functions, varying by
platform, and so this is being kept for the time being so that perl will
still work on a platform where these two functions are found to be
buggy, and Configure is overridden to forbid their use.

Moving the code to a separate function isolates it from the mainline
code, making that more understandable, and makes it easier to remove
this code if we decide to.

Using the -b or -w options to diff will make the deltas in this commit
more understandable, as the code was outdented in the new function.