Re: Simplify newNode()

From: Junwang Zhao <zhjwpku(at)gmail(dot)com>
To: Zhang Mingli <zmlpostgres(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: Simplify newNode()
Date: 2023-12-14 02:19:13
Message-ID: CAEG8a3+yOM5tngjiCtxKA1F2NeVQ16AvbvPnnhELALSnDDQKEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 14, 2023 at 9:34 AM Zhang Mingli <zmlpostgres(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message NINGWEI CHEN 2023-12-14 02:43:14 Re: Remove MSVC scripts from the tree
Previous Message Zhang Mingli 2023-12-14 01:34:26 Re: Simplify newNode()