From 90d6b40e1850c1b0849446bc02c3ffe9a376aaee Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 4 Jan 2014 18:53:17 +0100 Subject: [PATCH] vutil.c: Use existing macros instead of reinventing them If there had been documentation referring to these macros, I would have known they existed instead of reinventing them (not as well as the originals). --- vutil.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/vutil.c b/vutil.c index 06680dd..6cbfc72 100644 --- a/vutil.c +++ b/vutil.c @@ -564,13 +564,7 @@ Perl_upg_version(pTHX_ SV *ver, bool qv) char tbuf[64]; SV *sv = SvNVX(ver) > 10e50 ? newSV(64) : 0; char *buf; -#ifdef USE_LOCALE_NUMERIC - char *loc = NULL; - if (! PL_numeric_standard) { - loc = savepv(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC, "C"); - } -#endif + STORE_NUMERIC_LOCAL_SET_STANDARD(); if (sv) { Perl_sv_catpvf(aTHX_ sv, "%.9"NVff, SvNVX(ver)); len = SvCUR(sv); @@ -580,12 +574,7 @@ Perl_upg_version(pTHX_ SV *ver, bool qv) len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVff, SvNVX(ver)); buf = tbuf; } -#ifdef USE_LOCALE_NUMERIC - if (loc) { - setlocale(LC_NUMERIC, loc); - Safefree(loc); - } -#endif + RESTORE_NUMERIC_LOCAL(); while (buf[len-1] == '0' && len > 0) len--; if ( buf[len-1] == '.' ) len--; /* eat the trailing decimal */ version = savepvn(buf, len); -- 2.7.4