Re: Improve readability by using designated initializers when possible
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Michael Paquier <michael@paquier.xyz>,
jian he <jian.universality@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Japin Li <japinli@hotmail.com>,
Jelte Fennema-Nio <postgres@jeltef.nl>, Jeff Davis <pgsql@j-davis.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>,
pgsql-hackers@lists.postgresql.org
Date: 2024-03-13T13:24:32Z
Lists: pgsql-hackers
Attachments
- v3-0001-Remove-ObjectClass.patch (text/plain) patch v3-0001
On 08.03.24 06:50, Michael Paquier wrote: > On Mon, Mar 04, 2024 at 09:29:03AM +0800, jian he wrote: >> On Fri, Mar 1, 2024 at 5:26 PM Peter Eisentraut <peter@eisentraut.org> wrote: >>> Oops, there was a second commit in my branch that I neglected to send >>> in. Here is my complete patch set. > > Thanks for the new patch set. The gains are neat, giving nice > numbers: > 7 files changed, 200 insertions(+), 644 deletions(-) > > + default: > + DropObjectById(object); > + break; > > Hmm. I am not sure that this is a good idea. Wouldn't it be safer to > use as default path something that generates an ERROR so as this code > path would complain immediately when adding a new catalog? fixed in new patch > In getObjectDescription() and getObjectTypeDescription() this was a > safeguard, but we don't have that anymore. So it seems to me that > this should be replaced with a default with elog(ERROR)? fixed >> there is a `OCLASS` at the end of getObjectIdentityParts. > > Nice catch. A comment is not updated. > >> There is a `ObjectClass` in typedefs.list > > This is usually taken care of by committers or updated automatically. both fixed
Commits
-
Remove ObjectClass type
- 89e5ef7e2181 17.0 landed
-
Simplify pg_enc2gettext_tbl[] with C99-designated initializer syntax
- 655dc310460c 17.0 landed
-
Use C99-designated initializer syntax for arrays related to encodings
- ada87a4d95fc 17.0 landed
-
Remove last NULL element in config_group_names[]
- 48920476b490 17.0 landed
-
Use C99-designated initializer syntax for more arrays
- afd8ef39094b 17.0 landed
-
Remove unnecessary array object_classes[] in dependency.c
- ef5e2e90859a 17.0 landed
-
Add trailing commas to enum definitions
- 611806cd726f 17.0 cited