From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Minor refactorings to eliminate some static buffers |
Date: | 2024-08-06 22:15:57 |
Message-ID: | 2f6690c9-0ef7-43c6-9336-a55c3c5c7111@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-08-06 22:23:09 | Re: Remaining dependency on setlocale() |
Previous Message | Jeff Davis | 2024-08-06 21:59:55 | Remaining dependency on setlocale() |