make BuiltinTrancheNames less ugly

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема make BuiltinTrancheNames less ugly
Дата
Msg-id 202401231025.gbv4nnte5fmm@alvherre.pgsql
обсуждение исходный текст
Ответы Re: make BuiltinTrancheNames less ugly
Список pgsql-hackers
This array of tranche names is looking pretty ugly these days, and it'll
get worse as we add more members to it.  I propose to use C99 designated
initializers, like we've done for other arrays.  Patch attached.

The way I've coded in this patch, it means the array will now have 52
NULL pointers at the beginning.  I don't think this is a big deal and
makes the code prettier.  I see two alternatives:

1. Avoid all those NULLs by making each definition uglier (subtract
NUM_INDIVIDUAL_LWLOCKS from each array index) _and_ the usage of the
array by subtracting the same amount.  This saves 208 bytes at the
expense of making the code worse.

2. More invasively, rework generate-lwlocknames.pl so that both lwlocks
and these builtin tranche names appear in a single array.  (We could do
so by #include'ing lwlocknames.c at the top of the array).


Now, having written this proposal, I'm leaning towards idea 2 myself,
but since the patch here is less invasive, it seems worth having as
evidence.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"People get annoyed when you try to debug them."  (Larry Wall)

Вложения

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Sequence Access Methods, round two
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: make BuiltinTrancheNames less ugly