Re: Remove PointerIsValid()

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Chao Li <li.evan.chao@gmail.com>, Peter Eisentraut <peter@eisentraut.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-09-17T20:23:46Z
Lists: pgsql-hackers
On Thu, 18 Sept 2025 at 03:55, Robert Haas <robertmhaas@gmail.com> wrote:
> I agree that we should prefer foo != NULL, but if the surrounding code
> in a particular location just tests if (foo), then it may be better in
> that case to go that route.

+1. I generally do (var != NULL) for pointers rather than (var). I
think it makes the code easier to read as a reader instantly knows
"var" is a pointer and not an int or bool.

Also, agree that we can relax that a little when all the surrounding
code does (var)

David



Commits

  1. Remove PointerIsValid()