This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_vcatpvfn_flags: sort PL_numeric_radix_sv
authorDavid Mitchell <davem@iabyn.com>
Mon, 15 May 2017 17:59:54 +0000 (18:59 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 7 Jun 2017 08:11:01 +0000 (09:11 +0100)
commitd7ce3e216e4fc097060b79ddfd1cc497e74d21ad
tree8f2c54902537aede73b2608566b60ab6dfb9899a
parent784f8b3cbed61eec02af29dba2e2f906ab3de16a
Perl_sv_vcatpvfn_flags: sort PL_numeric_radix_sv

Under locales the radix point may not be just a simple '.' but a Unicode
string like "\N{ARABIC DECIMAL SEPARATOR}". Currently the hex f/p code
explicitly takes account of the length of this string when calculating the
buffer length, but the other branches don't - they just rely on the
"add 40 fudge factor" to protect them.

Instead, handle its length for all branches, and simplify utf8 handling.
Currently it checks post-format whether the radix point was utf8, and if
so marks the resulting buffer as utf8. Instead, check for utf8-ness at the
same time we check for length.

This new approach doesn't check whether the resulting string actually
contains the radix point string, so in principle the string could be
marked utf8 but not have any >127 chars. I think this is harmless.
sv.c