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

From: RekGRpth <rekgrpth(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c
Date: 2023-12-06 14:44:54
Message-ID: CAPgh2mJJ7XrHTWSnYEb92R4PoknrqopOKDe6+795=v3q1aD6Eg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

something like?

ср, 6 дек. 2023 г. в 18:55, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>:
>
> 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(at)gmail(dot)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

Attachment Content-Type Size
tzp.diff text/x-patch 4.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Laurenz Albe 2023-12-06 16:38:02 Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c
Previous Message Laurenz Albe 2023-12-06 13:55:25 Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c