diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-10-28 10:24:43 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-10-28 10:24:43 +0000 |
commit | 26010419775e4ca28b454a6cfa6da261c9f5f04c (patch) | |
tree | 0d250e872190d623d80126517519bb50e2a30d13 /sv.c | |
parent | 9f6d8fa917d7eeec5d84d0eecc61a766a8ab51ab (diff) | |
download | perl-26010419775e4ca28b454a6cfa6da261c9f5f04c.tar.gz |
Use the return value from sprintf and avoid a call to strlen
p4raw-id: //depot/perl@25862
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -9642,8 +9642,11 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV 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 */ + /* May return an empty string for digits==0 */ + if (*PL_efloatbuf) { + elen = strlen(PL_efloatbuf); goto float_converted; + } } else if ( c == 'f' && !precis) { if ((eptr = F0convert(nv, ebuf + sizeof ebuf, &elen))) break; @@ -9687,17 +9690,15 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV * where printf() taints but print($float) doesn't. * --jhi */ #if defined(HAS_LONG_DOUBLE) - if (intsize == 'q') - (void)sprintf(PL_efloatbuf, ptr, nv); - else - (void)sprintf(PL_efloatbuf, ptr, (double)nv); + elen = ((intsize == 'q') + ? my_sprintf(PL_efloatbuf, ptr, nv) + : my_sprintf(PL_efloatbuf, ptr, (double)nv)); #else - (void)sprintf(PL_efloatbuf, ptr, nv); + elen = my_sprintf(PL_efloatbuf, ptr, nv); #endif } float_converted: eptr = PL_efloatbuf; - elen = strlen(PL_efloatbuf); break; /* SPECIAL */ |