Re: Remove unnecessary else branch

From: Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Li Japin <japinli(at)hotmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove unnecessary else branch
Date: 2020-10-13 13:59:21
Message-ID: CANugjhuk9CtvPkLHgtFDGOEnx8M5AkgGb52aZv-ta_J+GFMKYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 13, 2020 at 6:37 PM Heikki Linnakangas <hlinnaka(at)iki(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-10-13 14:27:15 Re: Resetting spilled txn statistics in pg_stat_replication
Previous Message Heikki Linnakangas 2020-10-13 13:36:54 Re: Remove unnecessary else branch