From: John Peacock Date: Sun, 17 Sep 2006 16:58:58 +0000 (-0400) Subject: Re: [perl #37714] XSUB.h version check may fail due to locale X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=63e3af20059610d29fa934e8330849fee9c115c5;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #37714] XSUB.h version check may fail due to locale Message-ID: <450DB712.4040703@rowman.com> p4raw-id: //depot/perl@28864 --- diff --git a/universal.c b/universal.c index 52395cc..251fbac 100644 --- a/universal.c +++ b/universal.c @@ -691,10 +691,11 @@ XS(XS_version_qv) #ifdef USE_LOCALE_NUMERIC char *loc = setlocale(LC_NUMERIC, "C"); #endif - const STRLEN len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVgf, SvNVX(ver)); + STRLEN len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVgf, SvNVX(ver)); #ifdef USE_LOCALE_NUMERIC setlocale(LC_NUMERIC, loc); #endif + while (tbuf[len-1] == '0' && len > 0) len--; version = savepvn(tbuf, len); } else diff --git a/util.c b/util.c index dedd81a..7e26322 100644 --- a/util.c +++ b/util.c @@ -4303,11 +4303,10 @@ Perl_upg_version(pTHX_ SV *ver) if ( SvNOK(ver) ) /* may get too much accuracy */ { char tbuf[64]; - STRLEN len; #ifdef USE_LOCALE_NUMERIC char *loc = setlocale(LC_NUMERIC, "C"); #endif - len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVff, SvNVX(ver)); + STRLEN len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVff, SvNVX(ver)); #ifdef USE_LOCALE_NUMERIC setlocale(LC_NUMERIC, loc); #endif