From 2873255c3e6d344d1891cb263cbf1d246340046b Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sat, 20 Dec 2003 18:58:06 +0000 Subject: [PATCH] Solaris gconvert() doesn't like ndigits == 0. Currently we have no Configure test for troublesome gconvert(), so for now simply avoid the optimisation that calls gconvert() in this case. p4raw-id: //depot/perl@21931 --- sv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sv.c b/sv.c index 47616ce..fdfa6d0 100644 --- a/sv.c +++ b/sv.c @@ -8657,7 +8657,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV else return; if (*pp == 'g') { - if (digits < sizeof(ebuf) - NV_DIG - 10) { /* 0, point, slack */ + /* Add check for digits != 0 because it seems that some + gconverts are buggy in this case, and we don't yet have + a Configure test for this. */ + if (digits && digits < sizeof(ebuf) - NV_DIG - 10) { + /* 0, point, slack */ Gconvert(nv, (int)digits, 0, ebuf); sv_catpv(sv, ebuf); if (*ebuf) /* May return an empty string for digits==0 */ @@ -9367,7 +9371,9 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV if ( !(width || left || plus || alt) && fill != '0' && has_precis && intsize != 'q' ) { /* Shortcuts */ - if ( c == 'g') { + /* See earlier comment about buggy Gconvert when digits, + aka precis is 0 */ + if ( c == 'g' && precis) { Gconvert((NV)nv, (int)precis, 0, PL_efloatbuf); if (*PL_efloatbuf) /* May return an empty string for digits==0 */ goto float_converted; -- 2.7.4