From: Rafael Garcia-Suarez Date: Sun, 17 Sep 2006 13:32:18 +0000 (+0000) Subject: A better version of change #28847 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b5b5a8f0780c94d6973849925747efe92490a7da;p=p5sagit%2Fp5-mst-13.2.git A better version of change #28847 p4raw-link: @28847 on //depot/perl: e24f8a798207476769992a3387804af506c43eab p4raw-id: //depot/perl@28861 --- diff --git a/universal.c b/universal.c index 7bbcbdb..52395cc 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 6be13df..dedd81a 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); }