Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c)
Date
Msg-id CAEudQArKO9KNAkisS0Zb73bLDL2i9=w+s1dxr6NDTcd+3jaL-w@mail.gmail.com
Whole thread Raw
In response to Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c)  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c)
List pgsql-hackers
Em seg., 16 de mai. de 2022 às 20:26, David Rowley <dgrowleyml@gmail.com> escreveu:
On Sun, 15 May 2022 at 09:47, Ranier Vilela <ranier.vf@gmail.com> wrote:
> At function load_relcache_init_file, there is an unnecessary function call,
> to initialize pgstat_info pointer to NULL.
>
> MemSet(&rel->pgstat_info, 0, sizeof(rel->pgstat_info));

What seems to have happened here is the field was changed to become a
pointer in 77947c51c.  It's not incorrect to use MemSet() to zero out
the pointer field.  What it does probably do is confuse the casual
reader into thinking the field is a struct rather than a pointer to
one.   It's probably worth making that consistent with the other
fields so nobody gets confused.

Can you add a CF entry for PG16 for this so we come back to it after we branch?
Of course.
I will add it.

regards,
Ranier Vilela

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Provide read-only access to system catalog tables
Next
From: "Jonathan S. Katz"
Date:
Subject: Re: PostgreSQL 15 Beta 1 release announcement draft