Re: make BuiltinTrancheNames less ugly
| От | Heikki Linnakangas |
|---|---|
| Тема | Re: make BuiltinTrancheNames less ugly |
| Дата | |
| Msg-id | 31066a40-3844-4238-98a4-5eec3f8a598e@iki.fi обсуждение исходный текст |
| Ответ на | make BuiltinTrancheNames less ugly (Alvaro Herrera <alvherre@alvh.no-ip.org>) |
| Ответы |
Re: make BuiltinTrancheNames less ugly
|
| Список | pgsql-hackers |
On 23/01/2024 12:25, Alvaro Herrera wrote: > 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. Idea 2 seems pretty straightforward, +1 for that. -- Heikki Linnakangas Neon (https://neon.tech)
В списке pgsql-hackers по дате отправления: