From: Vincent Pit Date: Thu, 6 May 2010 20:14:31 +0000 (+0200) Subject: Stop returning 0 for sprintf("%.0g") X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d347ad18ecf3da70504843223bc83fa49705ebaf;p=p5sagit%2Fp5-mst-13.2.git Stop returning 0 for sprintf("%.0g") And also from throwing two "Missing argument" warnings for this construct. This was a regression introduced by 5b98cd54dff3b16344eab33ce6b09fb6fb1b89c2. --- diff --git a/sv.c b/sv.c index 4f2ad99..4fd9445 100644 --- a/sv.c +++ b/sv.c @@ -9391,8 +9391,10 @@ Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, if (svix < svmax) nv = SvNV(*svargs); - else + else { S_vcatpvfn_missing_argument(aTHX); + return; + } if (*pp == 'g') { /* Add check for digits != 0 because it seems that some gconverts are buggy in this case, and we don't yet have diff --git a/t/op/sprintf.t b/t/op/sprintf.t index 4d2fe49..2146be0 100644 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -374,7 +374,7 @@ __END__ >%+8.1f< >-1234.875< > -1234.9< >%*.*f< >[5, 2, 12.3456]< >12.35< >%f< >0< >0.000000< ->%.0f< >[]< >0 MISSING< +>%.0f< >[]< > MISSING< > %.0f< >[]< > 0 MISSING< >%.0f< >0< >0< >%.0f< >2**38< >274877906944< >Should have exact int'l rep'n< @@ -390,7 +390,9 @@ __END__ >%g< >12345.6789< >12345.7< >%+g< >12345.6789< >+12345.7< >%#g< >12345.6789< >12345.7< ->%.0g< >-0.0< >-0< >C99 standard mandates minus sign but C89 does not skip: MSWin32 VMS hpux:10.20 openbsd netbsd:1.5 irix darwin< +>%.0g< >[]< > MISSING< +> %.0g< >[]< > 0 MISSING< +>%.0g< >-0.0< >-0< >C99 standard mandates minus sign but C89 does not skip: MSWin32 VMS hpux:10.20 openbsd netbsd:1.5 irix darwin< >%.0g< >12345.6789< >1e+04< >%#.0g< >12345.6789< >1.e+04< >%.2g< >12345.6789< >1.2e+04<