Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 4bc02b797e6ab9f43737a027bc0d8aff62e1dd7a
      
https://github.com/Perl/perl5/commit/4bc02b797e6ab9f43737a027bc0d8aff62e1dd7a
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add braces, indent code

Prior to this commit, the 'switch' immediately followed the 'if' without
a left brace for the 'if'.  This conserved indentation and was feasible
because the scopes were identical..  But a future commit will want to
have the scope of the 'if' be larger than that of the 'switch', so add
the braces for the 'if' and indent the 'switch' code.

This commit also fixes white space on another line


  Commit: 59b7215e5fee5dedb052ea2bc5c6f6163752c81b
      
https://github.com/Perl/perl5/commit/59b7215e5fee5dedb052ea2bc5c6f6163752c81b
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Simplify loop

A slight restructuring saves some lines.


  Commit: 78cc5cdcc6dc715f5d7fde1971dbf595f7db62f4
      
https://github.com/Perl/perl5/commit/78cc5cdcc6dc715f5d7fde1971dbf595f7db62f4
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Change two #define names

They will soon have a more general meaning than currently.


  Commit: 40d5b9384b3d702bb1e84744af5e508de4c2c0a5
      
https://github.com/Perl/perl5/commit/40d5b9384b3d702bb1e84744af5e508de4c2c0a5
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Change parameter specification

S_populate_hash_from_localeconv() takes a mask of one or two bits that
specify which of LC_NUMERIC and/or LC_MONETARY to operate on.  Prior to
this commit, the appropriate bit was based on our internal index for the
relevant category(ies).  But we already have #defines of 0 for NUMERIC,
and 1 for MONETARY.  These are adjacent and start at 0, desirable
properties that the internal index doesn't necessarily have.

This commit changes to base the parameter on these 0,1 values.  This
will allow simplification in the next commit, and going forward.


  Commit: 9fa9581cae647ff9b99a2bb7df464b1642dcee9f
      
https://github.com/Perl/perl5/commit/9fa9581cae647ff9b99a2bb7df464b1642dcee9f
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Simplify some localeconv() code

The previous commits have allowed this code to determine by looking at
the position of a bit in a mask what is going on, and so the code that
used to be there to cope with not having that can be removed.


  Commit: 9c9f027c0b3cefac4f8c457d3a1733e77202084a
      
https://github.com/Perl/perl5/commit/9c9f027c0b3cefac4f8c457d3a1733e77202084a
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Move code to earlier in function

This is in preparation for the object created here to be needed earlier.

This commit also cleans up a comment related to the moved code


  Commit: e9ca90b7f7b551631b5b28ca8dfaf648d664c6ab
      
https://github.com/Perl/perl5/commit/e9ca90b7f7b551631b5b28ca8dfaf648d664c6ab
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Reorder some statements in a switch()

This unifies the common text in two case: statements, and makes all of
them do their business in the same order.

This makes it easier to compare and contrast the actions of the various
case:s


  Commit: 58a60b7dc5b948d46704beca71a54dbdf09b1c5e
      
https://github.com/Perl/perl5/commit/58a60b7dc5b948d46704beca71a54dbdf09b1c5e
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add some #defines

And collapse an existing one into one of the new ones, so as to use
a parallel naming convention

These will be used in future commits


  Commit: 6fae3797c68d17b71fa4659ae250d12344d0078e
      
https://github.com/Perl/perl5/commit/6fae3797c68d17b71fa4659ae250d12344d0078e
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Special case some C locale values

On Windows and MingW, some of this code can be frequently called, and
often with the C locale in effect.  Normally localeconv() is called to
fill in these values, but that is expensive in part because of a bunch
of setlocale() calls, some of which are extra, needed because of bugs in
the Windows libc.  We can short circuit that for the common C locale
case, as the values are specified by the C standard, so are known at
compile time.


  Commit: 70d86ac890560596579fdfc74b91dfc0ba933074
      
https://github.com/Perl/perl5/commit/70d86ac890560596579fdfc74b91dfc0ba933074
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

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

  Log Message:
  -----------
  locale.c: Use parallel array to simplify

This allows the numeric fields returned by localeconv() to have the same
logic as the string fields, simplifying the code a bit.  They weren't
previously handled the same because one category doesn't have any
numeric fields.  But this is now handled by creating an array and making
its corresponding element NULL, so the strings and numeric fields are
handled in the same way.


  Commit: bfe165bb00c8ed0aafbf9837f4fcfc23e582f1d8
      
https://github.com/Perl/perl5/commit/bfe165bb00c8ed0aafbf9837f4fcfc23e582f1d8
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

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

  Log Message:
  -----------
  Special case localeconv when NUMERIC, MONETARY must be C

When both these categories are C, we don't need to call localeconv(),
which can be expensive because it may mean toggling locales.  Instead
the answers are well defined by the C Standard.  This adds a function
that returns those, and #ifdef's to locale.c to compile to use the
special function instead of the more general one if both categories must
be C.

A future commit will extend the use of this new function to more cases.


  Commit: 1d57c711b8c06126168fa2a64f96b7c42082e9c9
      
https://github.com/Perl/perl5/commit/1d57c711b8c06126168fa2a64f96b7c42082e9c9
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

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

The previous commit introduced a surrounding #if, so indent the ones
within it.


  Commit: ef88f916a6948545e4f34f63e7a74fbcd5196ec3
      
https://github.com/Perl/perl5/commit/ef88f916a6948545e4f34f63e7a74fbcd5196ec3
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Move some code

When called with just a single item, we only need a single call to the
populating function, so move this code ahead of the 2nd call.  This also
clarifies the comments.


  Commit: a121b89a243ec49de082bfe831c88f8fe80eb110
      
https://github.com/Perl/perl5/commit/a121b89a243ec49de082bfe831c88f8fe80eb110
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c Special case localeconv for C locale

An earlier commit created a function that speedily works when both
LC_NUMERIC and LC_MONETARY are confined to the C locale, such as in
OpenBSD.  This commit extends that to use this function whenever a
category happens to be in the C locale.  This is a common case, that is
thus sped up.

Over the course of the development of locale.c, the meaning of not
having the various categories changed from not being on the machine, or
not paying attention to them, to instead mean, even if they are on the
machine, they are always kept in the C locale.  This code was not
updated to reflect that; and this commit also does that updating.


  Commit: b37ef033e255a7081eef2903a53b8755644f4d4a
      
https://github.com/Perl/perl5/commit/b37ef033e255a7081eef2903a53b8755644f4d4a
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use out-of-bounds value for illegality

This was using 0 as a parameter, which is a legal value and could have
been confused by the called subroutine as being legitimate.  It is not a
bug because of the way the subroutine is currently written given the
other parameters in this call.  But it is more robust to use an
out-of-bounds value, so that if the function were to change, we would
sooner find out about any improper call.


  Commit: ac64948b95afe08a458628a9d841c5b662a235a8
      
https://github.com/Perl/perl5/commit/ac64948b95afe08a458628a9d841c5b662a235a8
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Skip locale utf8ness calculation if feasible

I originally wrote this to save time processing the strings returned by
localeconv().  If we know that the locale isn't UTF-8, then we don't
have to calculate this for each string returned, Thus "Calculate once, not
many times".

But I hadn't realized that likely only one string is ever going to be
non-ASCII: the currency symbol.  (The decimal and thousands separators
could also be, but of the >500 locales on my Linux box, only ps_AF has
them so.  That is the Pashtun language in Afghanistan; not a frequently
occurring locale.)

So it comes down to either case is effectively "calculate once".  And it
is generally more expensive to calculate the UTF8ness of a locale than a
particular string in it, especially when those strings are going to be
ASCII, as in this case.

This commit changes to not calculate the locale's UTF8ness.


  Commit: f33a176a75bb3901b052be2682a8221d35a4d72c
      
https://github.com/Perl/perl5/commit/f33a176a75bb3901b052be2682a8221d35a4d72c
  Author: Karl Williamson <[email protected]>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Avoid unnecessary work around localeconv()

There are now two different functions that return the values for
localeconv().  One is for when the locale is "C"; the other for
everything else.  The C one returns values that don't need adjusting, so
skip that for this case.

This commit removes the SvPOK check which was recently added by
fe048cfaa3b42320785bd0c34896ac834634db22.  It was needed for before we
got values when -DNO_LOCALE_MONETARY is specified.  Now that we do get
those values, the SV always will contain a PV at this point.


Compare: https://github.com/Perl/perl5/compare/80be29bd8fd9...f33a176a75bb

Reply via email to