Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: aba64a3701304050c0c6046bda36a1454917c9f1
      
https://github.com/Perl/perl5/commit/aba64a3701304050c0c6046bda36a1454917c9f1
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  S_my_langinfo_i: Always return both a buffer and a value

This function returns a value, and also copies that value into a buffer.
Certain rare Configurations failed to fill in the buffer in some
circumstances.

This commit fixes bugs on those Configurations, and is the first step in
the next several commits in not doing unnecessary copies, which will
obsolete this commit.


  Commit: 7b7cc04c876ac4b0d6234204a55da6d5cf97341c
      
https://github.com/Perl/perl5/commit/7b7cc04c876ac4b0d6234204a55da6d5cf97341c
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

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

Some paths through this section of code don't require the result to be
saved to a buffer.  Move the code so to avoid that unnecessary work.

The result is indented an extra amount to prepare for a future commit.


  Commit: 329e972b3af43f395fdcbce2ae91e4cb4fe81977
      
https://github.com/Perl/perl5/commit/329e972b3af43f395fdcbce2ae91e4cb4fe81977
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Refactor use of Perl_form

This commit creates #define's for the format to use in that function
call.  This will make a future commit easier.


  Commit: 1497fbf95829b280cb87778bc86a3da858a9b046
      
https://github.com/Perl/perl5/commit/1497fbf95829b280cb87778bc86a3da858a9b046
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Indent a couple statements

This will allow them to vertically align with code added in a future
commit


  Commit: 756e776bc149386372dc453a4a2866527f1a7aba
      
https://github.com/Perl/perl5/commit/756e776bc149386372dc453a4a2866527f1a7aba
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Move a small block of code

This moves this conditional and function call to when the locale is
still toggled.  Prior to this change, it is possible that we would have
to re-toggle within the function call.

The extra indentation will make sense in a future commit


  Commit: ef8abfb46850e520b971e5b23aec0a557864e582
      
https://github.com/Perl/perl5/commit/ef8abfb46850e520b971e5b23aec0a557864e582
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add/clarify some comments


  Commit: cfc0f8aad9a2afec551523b32dc85cea5ca56d86
      
https://github.com/Perl/perl5/commit/cfc0f8aad9a2afec551523b32dc85cea5ca56d86
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Change name and API of static function

This now is passed a pointer to the value that may need to be
overridden, and returns a bool (ignored for the time being) as to
whether it changed it or not.

This is in preparation for a future commit.


  Commit: 788c5671ddbc3d066c813c08fb089b45f4d43adc
      
https://github.com/Perl/perl5/commit/788c5671ddbc3d066c813c08fb089b45f4d43adc
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use an SV instead of a PV in one place

This was creating a temporary PV; the commit changes to use a mortal SV.
This is in preparation for a future commit where the SV can be passed in
by a caller, and there will be fewer wasted mallocs and frees.


  Commit: a8c373685a54fe6738c866dfd06fae37bc91b3df
      
https://github.com/Perl/perl5/commit/a8c373685a54fe6738c866dfd06fae37bc91b3df
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Rename macro

I got tired of typing the prefix 'my_' and there is no good reason since
there is no symbol that differs only in that.


  Commit: 312a42c94577765993ec268f3907c6edc6160b70
      
https://github.com/Perl/perl5/commit/312a42c94577765993ec268f3907c6edc6160b70
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

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

  Log Message:
  -----------
  locale.c: Rename static function

This is in preparation for a future commit which will change its
parameter types


  Commit: 43e12d1ffb8542493c2ef8cd8654c6ff365b549c
      
https://github.com/Perl/perl5/commit/43e12d1ffb8542493c2ef8cd8654c6ff365b549c
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Rename variable

This makes all calls to this function use variables with the same name
uniformly througout the file.  This is in preparation for the next
commits.


  Commit: d39450b6cc56362f9f6fe4d9454b95a93b8e5b15
      
https://github.com/Perl/perl5/commit/d39450b6cc56362f9f6fe4d9454b95a93b8e5b15
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use same function interface throughout file

S_langinfo_sv_i() is passed a buffer to use, and also returns a value.
This commit changes all calls to it that don't stem from an external
caller to it to only look at the returned value, and to ignore the
buffer (which should have an identical value).  This is in preparation
for future commits which will avoid having a duplicated value.


  Commit: 8d9fa8c2beae94d6bd833183a37a8b2995fb2b27
      
https://github.com/Perl/perl5/commit/8d9fa8c2beae94d6bd833183a37a8b2995fb2b27
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Remove params from langinfo_c()

The second parameter removed here is always NULL

The first parameter removed here is now always '&scratch_buffer', as
previous commits have changed the name to.

This commit now removes the ability to pass anything else to the
langinfo_c() macro.  This would normally be brittle, but a couple of
commits down the line will resolve that.


  Commit: a5ca57aef77afa02392d25c17f117d521ffb136d
      
https://github.com/Perl/perl5/commit/a5ca57aef77afa02392d25c17f117d521ffb136d
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add langinfo_i()

This is just a small extension of langinfo_c(), allowing another place
in the code to use this interface.


  Commit: 60e050beb2e45ebd7ead7f1bf93f845b23c474b5
      
https://github.com/Perl/perl5/commit/60e050beb2e45ebd7ead7f1bf93f845b23c474b5
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

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

  Log Message:
  -----------
  locale.c: Change to use SVs for buffers for langinfo()

Prior to this commit, the code implementing the langinfo interface used
malloc'd buffers to store results in.

However, I discovered that perl has never implemented one langinfo item
properly, because its documentation is misleading.  And that item is not
a standard C string, but instead contains embedded NUL characters.

I started to implement an extension to the existing buffer interface to
handle that.  But then I realized it would need the equivalent of SvCUR
and SvLEN.

And then, I realized that the glibc extensions to nl_langinfo() return
values that are better interpreted as UVs than PVs.

To cope with all that, my implementation would be starting to smell like
perl's already-existing SV implementation.

So this commit changes to use SVs behind the scenes.

This presents some advantages here and in the next commit, due to the
maturity of the perl SV code.  The same SV can be reused for scratch
with potential for PV stealing, COW, fewer mallocs, etc.  The explicit
freeing of that SV can be delayed until global destruction.


  Commit: 2f86ccb37a00753cd02f3a4ac6dc25009ff1c6d8
      
https://github.com/Perl/perl5/commit/2f86ccb37a00753cd02f3a4ac6dc25009ff1c6d8
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Avoid extra copying in langinfo

The functions that are the interface to libc nl_langinfo() have two
masters.  One is for internal use in the file to get a result that is to
be used and discarded immediately.  The other is to external callers who
may want to keep the result around for a while.

Historically this was done by having the functions both return a value,
and place it into a malloc'd buffer.

Sometimes the result is trivial, and needs to be copied to the buffer.
Other times, other functions are called that return a buffer themselves,
and for which the return value must be extracted from.  In other words,
sometimes it is more convenient to have a simple value; and sometimes it
is more convenient to have a buffer.

Previous commits have paved the way for this one, which knows which
vehicle the desired result should be returned in.

In S_emulate_langinfo(), the most convenient vehicle is used for the
calculation, and just before returning, if the caller wants that one, it
is done; but if the caller wants the other one, the result must be
coerced into that vehicle.


  Commit: 535998424c7a795303c58cc7b7c469be2a46cd98
      
https://github.com/Perl/perl5/commit/535998424c7a795303c58cc7b7c469be2a46cd98
  Author: Karl Williamson <k...@cpan.org>
  Date:   2024-01-14 (Sun, 14 Jan 2024)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Skip an intermediate copy

This commit takes advantage of the previous ones to pass the desired SV
directly to the langinfo() function, rather than getting a string and
then putting it into the SV


Compare: https://github.com/Perl/perl5/compare/f1902d2eb205...535998424c7a

Reply via email to