Thread: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

[PATCH] Style, remove redudant test "if (zeropadlen > 0)"

From
Ranier Vilela
Date:
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

Re: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

From
Mark Dilger
Date:

On 11/24/19 8:12 AM, Ranier Vilela wrote:
> Hi,
> The test "if (zeropadlen > 0)" is redundant and can be salely removed.
> It has already been tested in the same path.

I have not tested your patch, but it looks right to me.


-- 
Mark Dilger



RE: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

From
Ranier Vilela
Date:
>I have not tested your patch, but it looks right to me.
Thanks for review.

Best regards.
Ranier Vilela


Re: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

From
John W Higgins
Date:


On Sun, Nov 24, 2019 at 8:12 AM Ranier Vilela <ranier_gyn@hotmail.com> wrote:
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

Could you please at least take the time to produce a patch that actually applies properly? 

If the patch does not have the proper path from the root of the source tree than it is completely worthless to most folks because it's really not appropriate to ask someone to fix your patch when the tools are clearly available to properly produce a patch without any issue.

Specifically git diff does this without issue.

Thanks in advance

John

Re: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

From
Tom Lane
Date:
Mark Dilger <hornschnorter@gmail.com> writes:
> On 11/24/19 8:12 AM, Ranier Vilela wrote:
>> The test "if (zeropadlen > 0)" is redundant and can be salely removed.
>> It has already been tested in the same path.

> I have not tested your patch, but it looks right to me.

Agreed, seems like an oversight in an old patch of mine.  Pushed.

I concur with John's nearby complaint that you're not submitting
diffs in a useful format.  The file paths are weird.  Also, it's
generally proven to be a good idea to send diffs as attachments,
not embedded in-line in the email --- in-line text is far too
prone to get mangled by assorted mail programs.

            regards, tom lane



RE: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

From
Ranier Vilela
Date:
>Could you please at least take the time to produce a patch that actually applies properly?
Yes of course.
Thank you.

Ranier Vilela