summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2003-12-20 18:58:06 +0000
committerNicholas Clark <nick@ccl4.org>2003-12-20 18:58:06 +0000
commit2873255c3e6d344d1891cb263cbf1d246340046b (patch)
tree023397324a9e20adddd6626a41e874637eb1d46c /sv.c
parent2ed511eccdb1c54a77a99ffd2e8b3d8cf558b45c (diff)
downloadperl-2873255c3e6d344d1891cb263cbf1d246340046b.tar.gz
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
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index 47616ce5f7..fdfa6d00d0 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;