Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c
Дата
Msg-id da26cdf3558c605244838ca899c96c8874bbe92d.camel@cybertec.at
обсуждение исходный текст
Ответ на BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c  (RekGRpth <rekgrpth@gmail.com>)
Список pgsql-bugs
On Wed, 2023-12-06 at 04:49 +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference:      18230
> Logged by:          RekGRpth
> Email address:      rekgrpth@gmail.com
> PostgreSQL version: 16.1
> Operating system:   all
> Description:       
>
> All versions of PostgreSQL has redundant comparison of a local variable
> 'tzp' address with a NULL value at dt_common.c in DecodeDateTime function.
>
> ```c
> ...
>     int            t = 0;
>     int           *tzp = &t;
> ...
>     if (tzp != NULL)
> ...
>
>                     if (tzp == NULL)

That's not really a bug, but should certainly be improved.

At fault is commit 635a0b9a864, which removed "tzp" as a parameter from
"DecodeDateTime" and replaced it with a constant pointer to 0, when it
should have done more, like remove the variable and its uses.

Do you want to write a patch?

Yours,
Laurenz Albe



В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c
Следующее
От: RekGRpth
Дата:
Сообщение: Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c