Remove a couple of unnecessary if-tests.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 24 Nov 2019 17:03:16 +0000 (12:03 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 24 Nov 2019 17:03:16 +0000 (12:03 -0500)
Commit abd9ca377 replaced a couple of while-loops in fmtfloat()
with calls to dopr_outchmulti, but I (tgl) failed to notice that
the new if-tests guarding those calls were really unnecessary,
because they're inside a larger if-block checking the same thing.

Ranier Vilela

Discussion: https://postgr.es/m/MN2PR18MB2927850AB00CF39CC370D107E34B0@MN2PR18MB2927.namprd18.prod.outlook.com

src/port/snprintf.c

index e4bb15dfec1879cdc17e47aa46d846a85276151c..5c827ef6fe454a5dd4b9d1523e14e96543630ebb 100644 (file)
@@ -1227,16 +1227,14 @@ fmtfloat(double value, char type, int forcesign, int leftjust,
        {
            /* pad before exponent */
            dostr(convert, epos - convert, target);
-           if (zeropadlen > 0)
-               dopr_outchmulti('0', zeropadlen, target);
+           dopr_outchmulti('0', zeropadlen, target);
            dostr(epos, vallen - (epos - convert), target);
        }
        else
        {
            /* no exponent, pad after the digits */
            dostr(convert, vallen, target);
-           if (zeropadlen > 0)
-               dopr_outchmulti('0', zeropadlen, target);
+           dopr_outchmulti('0', zeropadlen, target);
        }
    }
    else