[Perl/perl5] 4e0418: locale.c: Rmv extraneous statement

2024-01-15 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 4e041828c77df5e8ee5310c314817314530cd1f4
  
https://github.com/Perl/perl5/commit/4e041828c77df5e8ee5310c314817314530cd1f4
  Author: Karl Williamson 
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Rmv extraneous statement

Since 60e050beb2e45ebd7ead7f1bf93f845b23c474b5, this isn't necessary.

Spotted by Tony Cook


  Commit: 26830906eb0df48e0b835354edab68236dcaf22d
  
https://github.com/Perl/perl5/commit/26830906eb0df48e0b835354edab68236dcaf22d
  Author: Karl Williamson 
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Use strtod over snprintf for radix determination

I have been a little leery of parsing a formatted number to look for the
radix character, which is what has been done with snprintf on MingW.  It
just seems brittle; it's possible (if unlikely) for the output to be
right-to-left, for example.

And then I saw cases where snprintf always used a dot on MingW; and the
Windows documentation makes no mention of the possibility of another
radix character.  Experimentation by Tony Cook showed that it could
output a comma instead; and the dots I was getting were probably cockpit
errors.

But almost all locales in the world use either a dot or a comma, and I
think it better to start with a string "1,5" or "1.5" and see which
strtod() parses correctly.  We then don't have to ourselves parse, but
see how strtod parses known strings by looking at what it calculates as
the value.  In a dot locale, for example, "1,5" will not yield anything
like 1.5.

Should we encounter a locale not using either a dot nor a comma, the
code drops down to call localeconv() to return the actual character
string.  On platforms where using localeconv() isn't known to have a
race (MSVC since VS2015, for example), the code previously always used
localeconv(), because of my leeriness about parsing an unknown string.

But now strtod is used, being less buggy and faster than localeconv; and
less brittle thant snprintf.

This change also avoids the malloc that the snprintf() version required.


Compare: https://github.com/Perl/perl5/compare/0b52bb633d8c...26830906eb0d


[Perl/perl5] 0b52bb: Return C values if localeconv() not available

2024-01-15 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 0b52bb633d8c55bb15f05cdb19a4b7cb071ea271
  
https://github.com/Perl/perl5/commit/0b52bb633d8c55bb15f05cdb19a4b7cb071ea271
  Author: Karl Williamson 
  Date:   2024-01-15 (Mon, 15 Jan 2024)

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

  Log Message:
  ---
  Return C values if localeconv() not available

localeconv() is a C89 function.  But the existing code handled the case
if it isn't available anyway by returning an empty hash if
POSIX::localeconv() is called.  Prior commits have made it actually
easier to instead return the hash populated with the values that the C
locale has, which is more desirable than the current state.  And that is
what this commit does.

There are reasons that localeconv() might not be available.  We recently
had a case where Configure didn't catch its existence.  And it still is
broken on MingW, and until recently on older Windows releases that we
now no longer support.  Workarounds were developed for those cases, but
there may be other platforms where it ends up broken without a
workaround, and this code handles them better and more simply than
before this commit.




[Perl/perl5] 511669: Add API function sv_langinfo()

2024-01-15 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 51166936e4342134180c32271e1bbc5e0f9f2a02
  
https://github.com/Perl/perl5/commit/51166936e4342134180c32271e1bbc5e0f9f2a02
  Author: Karl Williamson 
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
M embed.fnc
M embed.h
M ext/I18N-Langinfo/Langinfo.xs
M locale.c
M pod/perldelta.pod
M proto.h

  Log Message:
  ---
  Add API function sv_langinfo()

This performs the same task as Perl_langinfo8(), but returns an SV.
This is typically more convenient for the caller.

It turns out that nl_langinfo() has some weird returns that aren't yet
exposed by perl, but future commits will.  An SV makes these easier to
cope with.




[Perl/perl5] 862eff: perlapi: Emphasize that setpv() doesn't change the...

2024-01-15 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 862efff77390e71807deb409e51fb9a5a0034807
  
https://github.com/Perl/perl5/commit/862efff77390e71807deb409e51fb9a5a0034807
  Author: Karl Williamson 
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
M sv.c

  Log Message:
  ---
  perlapi: Emphasize that setpv() doesn't change the UTF-8 flag

I keep getting tripped up by this.




[Perl/perl5] 08cb8d: Configure: Handle case of no localeconv() found

2024-01-15 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 08cb8dc811173a8180d7ea8c58ba9f609d1a4e42
  
https://github.com/Perl/perl5/commit/08cb8dc811173a8180d7ea8c58ba9f609d1a4e42
  Author: Karl Williamson 
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
M Configure

  Log Message:
  ---
  Configure: Handle case of no localeconv() found

If not found, there certainly won't be a subset of its returns




[Perl/perl5] fb2394: Langinfo.pm: Change list init indents; sort order

2024-01-15 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: fb2394a7ea9c135fd44d3fca59cc38857812758f
  
https://github.com/Perl/perl5/commit/fb2394a7ea9c135fd44d3fca59cc38857812758f
  Author: Karl Williamson 
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
M ext/I18N-Langinfo/Langinfo.pm

  Log Message:
  ---
  Langinfo.pm: Change list init indents; sort order

10 should come after 9




[Perl/perl5] 6028b1: locale.c: White space only

2024-01-15 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 6028b17614d0ad1a9def5e7eaf569987a74b27b7
  
https://github.com/Perl/perl5/commit/6028b17614d0ad1a9def5e7eaf569987a74b27b7
  Author: Karl Williamson 
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
M locale.c

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




[Perl/perl5] ca4e10: Unmatched {} in C file generated by Configure issu...

2024-01-15 Thread H.Merijn Brand
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: ca4e10252da38325f00fc662b8873b102c3781b2
  
https://github.com/Perl/perl5/commit/ca4e10252da38325f00fc662b8873b102c3781b2
  Author: H.Merijn Brand 
  Date:   2024-01-15 (Mon, 15 Jan 2024)

  Changed paths:
M Configure

  Log Message:
  ---
  Unmatched {} in C file generated by Configure issue#21730 m-hilgendorf