summaryrefslogtreecommitdiff
path: root/vutil.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-01-04 18:53:17 +0100
committerKarl Williamson <public@khwilliamson.com>2014-01-04 13:33:06 -0700
commit90d6b40e1850c1b0849446bc02c3ffe9a376aaee (patch)
tree41fd55b417fd2dfd60715196a1dbf0e4f63f8f41 /vutil.c
parent371d5d44b054ca1540da57f7be95194f1d92f449 (diff)
downloadperl-90d6b40e1850c1b0849446bc02c3ffe9a376aaee.tar.gz
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).
Diffstat (limited to 'vutil.c')
-rw-r--r--vutil.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/vutil.c b/vutil.c
index 06680dd6fb..6cbfc72a22 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);