Removal of duplicate variable declarations in fe-connect.c
Hi Hackers,
During the development of another feature, I found that same local
variables are declared twice.
IMO, there is no need of again declaring the local variables. Patch
attached.
Regards,
Haribabu Kommi
Fujitsu Australia
Attachments:
0001-Removal-of-duplicate-local-variable-declaration.patchapplication/octet-stream; name=0001-Removal-of-duplicate-local-variable-declaration.patchDownload
From a4432a2764163fe4d5ad728fed6949cd1f8d5b27 Mon Sep 17 00:00:00 2001
From: Hari Babu <kommi.haribabu@gmail.com>
Date: Fri, 22 Feb 2019 00:34:38 +1100
Subject: [PATCH] Removal of duplicate local variable declaration
Same variables are declared once again inside an if block, but
there is no need of two declarations, the inside block can reuse
the outside block declared variables itself.
---
src/interfaces/libpq/fe-connect.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index f29202db5f..c96a52bb1b 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -3349,9 +3349,6 @@ keep_going: /* We will come back to here until there is
if (strncmp(val, "on", 2) == 0)
{
/* Not writable; fail this connection. */
- const char *displayed_host;
- const char *displayed_port;
-
PQclear(res);
restoreErrorMessage(conn, &savedMessage);
--
2.20.1.windows.1
On Fri, Feb 22, 2019 at 11:33:17AM +1100, Haribabu Kommi wrote:
During the development of another feature, I found that same local
variables are declared twice.
IMO, there is no need of again declaring the local variables. Patch
attached.
Indeed, fixed. That's not a good practice, and each variable is
assigned in its own block before getting used, so there is no
overlap.
--
Michael
On Fri, Feb 22, 2019 at 3:22 PM Michael Paquier <michael@paquier.xyz> wrote:
On Fri, Feb 22, 2019 at 11:33:17AM +1100, Haribabu Kommi wrote:
During the development of another feature, I found that same local
variables are declared twice.
IMO, there is no need of again declaring the local variables. Patch
attached.Indeed, fixed. That's not a good practice, and each variable is
assigned in its own block before getting used, so there is no
overlap.
Thanks.
Regards,
Haribabu Kommi
Fujitsu Australia