[PATCH] Style, remove redudant test "if (zeropadlen > 0)" - Mailing list pgsql-hackers

From Ranier Vilela
Subject [PATCH] Style, remove redudant test "if (zeropadlen > 0)"
Date
Msg-id MN2PR18MB2927850AB00CF39CC370D107E34B0@MN2PR18MB2927.namprd18.prod.outlook.com
Whole thread Raw
Responses Re: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"  (Mark Dilger <hornschnorter@gmail.com>)
Re: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"  (John W Higgins <wishdev@gmail.com>)
List pgsql-hackers
Hi,
The test "if (zeropadlen > 0)" is redundant and can be salely removed.
It has already been tested in the same path.

Best regards,
Ranier Vilela

--- \dll\postgresql\a\port\snprintf.c    2019-11-23 13:19:20.000000000 -0300
+++ snprintf.c    2019-11-24 13:02:45.510806400 -0300
@@ -1227,16 +1227,14 @@
         {
             /* 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

Attachment

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: Copyright information in source files
Next
From: Mark Dilger
Date:
Subject: Re: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"