Re: Minor refactorings to eliminate some static buffers

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Minor refactorings to eliminate some static buffers
Дата
Msg-id 2f6690c9-0ef7-43c6-9336-a55c3c5c7111@iki.fi
обсуждение исходный текст
Ответ на Re: Minor refactorings to eliminate some static buffers  (Peter Eisentraut <peter@eisentraut.org>)
Список 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)




В списке pgsql-hackers по дате отправления: