Re: Propose a new function - list_is_empty - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Propose a new function - list_is_empty
Date
Msg-id 1116757.1660657071@sss.pgh.pa.us
Whole thread Raw
In response to Re: Propose a new function - list_is_empty  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes:
> I think these are nice cleanups to simplify and streamline the code, just a few
> small comments from reading the patch:

>      /* If no subcommands, don't collect */
> -    if (list_length(currentEventTriggerState->currentCommand->d.alterTable.subcmds) != 0)
> +    if (currentEventTriggerState->currentCommand->d.alterTable.subcmds)
> Here the current coding gives context about the data structure used for the
> subcmds member which is now lost.  I don't mind the change but rewording the
> comment above to indicate that subcmds is a list would be good IMHO.

I think testing for equality to NIL is better where that's a concern.

> Might be personal taste, but I think the parenthesis should be kept here as a
> visual aid for the reader.

+1

            regards, tom lane



pgsql-hackers by date:

Previous
From: "Drouvot, Bertrand"
Date:
Subject: Re: shared-memory based stats collector - v70
Next
From: Robert Haas
Date:
Subject: Re: Propose a new function - list_is_empty