Re: Remove unnecessary else branch - Mailing list pgsql-hackers

From Hamid Akhtar
Subject Re: Remove unnecessary else branch
Date
Msg-id CANugjhuk9CtvPkLHgtFDGOEnx8M5AkgGb52aZv-ta_J+GFMKYA@mail.gmail.com
Whole thread Raw
In response to Re: Remove unnecessary else branch  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: Remove unnecessary else branch
Re: Remove unnecessary else branch
List pgsql-hackers


On Tue, Oct 13, 2020 at 6:37 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 13/10/2020 16:30, Li Japin wrote:
> Hi,
>
> I found in guc-file.l we can omit the else branch in AbsoluteConfigLocation().

It will compile the same, so it's just a matter of code readability or
taste which style is better here. I think we should leave it alone, it's
fine as it is.

- Heikki



I agree with Heikki from the code execution point of view. 

"canonicalize_path(abs_path);" statement is also condition independent and can be pulled out of both if and else blocks. Removing unnecessary statements makes the code more readable, but it is a matter of choice/style.

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Remove unnecessary else branch
Next
From: Tom Lane
Date:
Subject: Re: Resetting spilled txn statistics in pg_stat_replication