Re: Should we use MemSet or {0} for struct initialization? - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Should we use MemSet or {0} for struct initialization?
Date
Msg-id 0db914aa-cb4c-d399-ce55-5acab65e34c7@eisentraut.org
Whole thread Raw
In response to Should we use MemSet or {0} for struct initialization?  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Should we use MemSet or {0} for struct initialization?
List pgsql-hackers
On 31.08.23 10:32, Richard Guo wrote:
> 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.

The first part (parse_target.c) was already addressed by e0e492e5a9.  I 
have applied the second part (pgstatfuncs.c).




pgsql-hackers by date:

Previous
From: bt23nguyent
Date:
Subject: Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set
Next
From: Matthias van de Meent
Date:
Subject: Re: XLog size reductions: Reduced XLog record header size for PG17