From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Should we use MemSet or {0} for struct initialization? |
Date: | 2023-08-31 08:32:59 |
Message-ID: | CAMbWs490gJf5A=ydqyjh+Z8mVQa_foTGtcmBtHGLra0aOwLWHQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
While working on a bug in expandRecordVariable() I noticed that in the
switch statement for case RTE_SUBQUERY we initialize struct ParseState
with {0} while for case RTE_CTE we do that with MemSet. I understand
that there is nothing wrong with this, just cannot get away with the
inconsistency inside the same function (sorry for the nitpicking).
Do we have a preference for how to initialize structures? From 9fd45870
it seems that we prefer to {0}. So here is a trivial patch doing that.
And with a rough scan the MemSet calls in pg_stat_get_backend_subxact()
can also be replaced with {0}, so include that in the patch too.
Thanks
Richard
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Replace-more-MemSet-calls-with-struct-initialization.patch | application/octet-stream | 1.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2023-08-31 08:36:31 | Commitfest 2023-09 starts soon |
Previous Message | torikoshia | 2023-08-31 07:47:21 | Re: Make --help output fit within 80 columns per line |