summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2023-01-12 17:31:24 -0700
committerKarl Williamson <khw@cpan.org>2023-02-10 15:35:49 -0700
commita683fa5b7e816ae5c10d246c9a0b1f3ea743274b (patch)
treecda0e5d3ef7599590f3b1f1edfea7894af56adce /perlio.c
parenta170805d60a9631c88faf0da744391bfc8f2fe26 (diff)
downloadperl-a683fa5b7e816ae5c10d246c9a0b1f3ea743274b.tar.gz
snprintf() calls need to have proper radix
Calls to libc snprintf() were neglected to be changed when perl was fixed to change the radix character to the proper one based on whether or not 'use locale' is in effect. Perl-level code is unaffected, but core and XS code is. This commit changes to wrap snprintf() calls with the macros designed for the purpose, long used for similar situations elsewhere in the code. Doing this requires the thread context. I achieved this in a few places by a dTHX, instead of assuming a caller would have the context already available, and adding a pTHX_ parameter. I tried doing it the other way, and got a few breakages in our test suite. Formatting already requires significant CPU time, so this addition should just be in the noise This bug was found by new tests that will be added in a future commit.
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/perlio.c b/perlio.c
index 287b6e099b..c5ed3f0a64 100644
--- a/perlio.c
+++ b/perlio.c
@@ -369,7 +369,10 @@ PerlIO_debug(const char *fmt, ...)
should be, otherwise the system isn't likely to support quadmath.
Nothing should be calling PerlIO_debug() with floating point anyway.
*/
+ DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
+ STORE_LC_NUMERIC_SET_TO_NEEDED();
const STRLEN len2 = vsnprintf(buffer + len1, sizeof(buffer) - len1, fmt, ap);
+ RESTORE_LC_NUMERIC();
# else
STATIC_ASSERT_STMT(0);
# endif