[PATCH] Tiny optimization.

Started by Ranier Vilelaabout 6 years ago3 messages
#1Ranier Vilela
ranier_gyn@hotmail.com
1 attachment(s)

Hi,
Remove redutant test.

best regards.
Ranier Vilela

--- \dll\postgresql-12.0\a\backend\executor\execExpr.c	Mon Sep 30 17:06:55 2019
+++ execExpr.c	Fri Nov 22 18:50:32 2019
@@ -2426,7 +2426,7 @@
 	{
 		desc = parent->scandesc;
-		if (parent && parent->scanops)
+		if (parent->scanops)
 			tts_ops = parent->scanops;

if (parent->scanopsset)

Attachments:

execExpr.c.patchapplication/octet-stream; name=execExpr.c.patchDownload
--- \dll\postgresql-12.0\a\backend\executor\execExpr.c	Mon Sep 30 17:06:55 2019
+++ execExpr.c	Fri Nov 22 18:50:32 2019
@@ -2426,7 +2426,7 @@
 	{
 		desc = parent->scandesc;
 
-		if (parent && parent->scanops)
+		if (parent->scanops)
 			tts_ops = parent->scanops;
 
 		if (parent->scanopsset)
#2Andreas Karlsson
andreas@proxel.se
In reply to: Ranier Vilela (#1)
Re: [PATCH] Tiny optimization.

On 11/22/19 10:58 PM, Ranier Vilela wrote:

Remove redutant test.

Yeah, this test does look redundant since we already check for if parent
is NULL earlier in the function. Any optimizing compiler should see this
too, but it is still a good idea to remove it for code clarity.

Andreas

#3Bruce Momjian
bruce@momjian.us
In reply to: Andreas Karlsson (#2)
Re: [PATCH] Tiny optimization.

On Sat, Nov 23, 2019 at 10:44:47AM +0100, Andreas Karlsson wrote:

On 11/22/19 10:58 PM, Ranier Vilela wrote:

Remove redutant test.

Yeah, this test does look redundant since we already check for if parent is
NULL earlier in the function. Any optimizing compiler should see this too,
but it is still a good idea to remove it for code clarity.

Agreed, patch applied.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +