summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-09-17 13:32:18 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-09-17 13:32:18 +0000
commitb5b5a8f0780c94d6973849925747efe92490a7da (patch)
treee56811095a9475ce567bc644e8de17bde8d48367
parentc5d12488d9324671cce63c4feed858f82530110e (diff)
downloadperl-b5b5a8f0780c94d6973849925747efe92490a7da.tar.gz
A better version of change #28847
p4raw-link: @28847 on //depot/perl: e24f8a798207476769992a3387804af506c43eab p4raw-id: //depot/perl@28861
-rw-r--r--universal.c6
-rw-r--r--util.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/universal.c b/universal.c
index 7bbcbdbed9..52395cce69 100644
--- a/universal.c
+++ b/universal.c
@@ -688,7 +688,13 @@ XS(XS_version_qv)
if ( SvNOK(ver) ) /* may get too much accuracy */
{
char tbuf[64];
+#ifdef USE_LOCALE_NUMERIC
+ char *loc = setlocale(LC_NUMERIC, "C");
+#endif
const STRLEN len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVgf, SvNVX(ver));
+#ifdef USE_LOCALE_NUMERIC
+ setlocale(LC_NUMERIC, loc);
+#endif
version = savepvn(tbuf, len);
}
else
diff --git a/util.c b/util.c
index 6be13df4a9..dedd81a17d 100644
--- a/util.c
+++ b/util.c
@@ -4304,9 +4304,13 @@ Perl_upg_version(pTHX_ SV *ver)
{
char tbuf[64];
STRLEN len;
- SET_NUMERIC_STANDARD();
+#ifdef USE_LOCALE_NUMERIC
+ char *loc = setlocale(LC_NUMERIC, "C");
+#endif
len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVff, SvNVX(ver));
- SET_NUMERIC_LOCAL();
+#ifdef USE_LOCALE_NUMERIC
+ setlocale(LC_NUMERIC, loc);
+#endif
while (tbuf[len-1] == '0' && len > 0) len--;
version = savepvn(tbuf, len);
}