Re: Simplify newNode()
Junwang Zhao <zhjwpku@gmail.com>
From: Junwang Zhao <zhjwpku@gmail.com>
To: Zhang Mingli <zmlpostgres@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>,
Heikki Linnakangas <hlinnaka@iki.fi>
Date: 2023-12-14T02:19:13Z
Lists: pgsql-hackers
On Thu, Dec 14, 2023 at 9:34 AM Zhang Mingli <zmlpostgres@gmail.com> wrote:
>
> Hi,
>
> LGTM.
>
> + Assert(size >= sizeof(Node)); /* need the tag, at least */
> + result = (Node *) palloc0fast(size);
> + result->type = tag;
>
> + return result;
> +}
>
> How about moving the comments /* need the tag, at least */ after result->type = tag; by the way?
I don't think so, the comment has the meaning of the requested size
should at least the size
of Node, which contains just a NodeTag.
typedef struct Node
{
NodeTag type;
} Node;
>
>
>
> Zhang Mingli
> www.hashdata.xyz
--
Regards
Junwang Zhao
Commits
-
Simplify newNode() by removing special cases
- 3c080fb4fad3 17.0 landed