Re: Remove unnecessary else branch

Поиск
Список
Период
Сортировка
От Hamid Akhtar
Тема Re: Remove unnecessary else branch
Дата
Msg-id CANugjhuk9CtvPkLHgtFDGOEnx8M5AkgGb52aZv-ta_J+GFMKYA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Remove unnecessary else branch  (Heikki Linnakangas <hlinnaka@iki.fi>)
Ответы Re: Remove unnecessary else branch  (Li Japin <japinli@hotmail.com>)
Re: Remove unnecessary else branch  (Li Japin <japinli@hotmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Remove unnecessary else branch
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Resetting spilled txn statistics in pg_stat_replication