On 06/08/2024 23:41, Peter Eisentraut wrote:
On 06.08.24 17:13, Heikki Linnakangas wrote:
> --- a/src/backend/access/transam/xlogprefetcher.c
> +++ b/src/backend/access/transam/xlogprefetcher.c
> @@ -362,7 +362,7 @@ XLogPrefetcher *
> XLogPrefetcherAllocate(XLogReaderState *reader)
> {
> XLogPrefetcher *prefetcher;
> - static HASHCTL hash_table_ctl = {
> + const HASHCTL hash_table_ctl = {
Is there a reason this is not changed to
static const HASHCTL ...
? Most other places where changed in that way.
No particular reason. Grepping for HASHCTL's, this is actually different
from all other uses of HASHCTL and hash_create. All others use a plain
local variable, and fill the fields like this:
HASHCTL hash_ctl;
hash_ctl.keysize = sizeof(missing_cache_key);
hash_ctl.entrysize = sizeof(missing_cache_key);
hash_ctl.hcxt = TopMemoryContext;
hash_ctl.hash = missing_hash;
hash_ctl.match = missing_match;
I think that's just because we haven't allowed C99 designated
initializers for very long.
--
Heikki Linnakangas
Neon (https://neon.tech)