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

Started by Ranier Vilelaover 6 years ago6 messageshackers
Jump to latest
#1Ranier Vilela
ranier.vf@gmail.com

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

Attachments:

snprintf.c.patchapplication/octet-stream; name=snprintf.c.patchDownload+2-4
#2Mark Dilger
mark.dilger@enterprisedb.com
In reply to: Ranier Vilela (#1)
Re: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

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

#3Ranier Vilela
ranier.vf@gmail.com
In reply to: Mark Dilger (#2)
RE: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

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

Thanks for review.

Best regards.
Ranier Vilela

#4John W Higgins
wishdev@gmail.com
In reply to: Ranier Vilela (#1)
Re: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

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

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Mark Dilger (#2)
Re: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

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

#6Ranier Vilela
ranier.vf@gmail.com
In reply to: John W Higgins (#4)
RE: [PATCH] Style, remove redudant test "if (zeropadlen > 0)"

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

Yes of course.
Thank you.

Ranier Vilela