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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: RekGRpth <rekgrpth(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, 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-07 02:32:33
Message-ID: ZXEuwRR0Sq012eiu@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Dec 07, 2023 at 09:51:57AM +0800, Richard Guo wrote:
> There are several places in DecodeDateTime() where the value of '*tzp'
> is changed. It seems to me that these assignments are unnecessary since
> the value of '*tzp' is not utilized anywhere in the code. Can we also
> remove these assignments?

*tzp could be given to DecodeTimezone() and manipulated inside it, but
you are right that we don't use it at all in the DecodeDateTime()
path. Other callers of DecodeTimezone() may depend on the changes
done inside it, though. Perhaps DecodeTimezone() should be extended
so as it can accept a NULL value and use that in DecodeDateTime(),
eliminating the need for *tzp entirely?
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message RekGRpth 2023-12-07 02:39:35 Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c
Previous Message RekGRpth 2023-12-07 02:28:02 Re: BUG #18230: Redundant comparison of a local variable 'tzp' address with a NULL value at dt_common.c