Improve readability by using designated initializers when possible
Jelte Fennema-Nio <postgres@jeltef.nl>
From: Jelte Fennema-Nio <postgres@jeltef.nl>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Michael Paquier <michael@paquier.xyz>,
Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2024-02-21T15:03:31Z
Lists: pgsql-hackers
Attachments
- v1-0001-Use-designated-initializer-syntax-to-improve-read.patch (application/octet-stream) patch v1-0001
Usage of designated initializers came up in: https://www.postgresql.org/message-id/flat/ZdWXhAt9Tz4d-lut%40paquier.xyz#9dc17e604e58569ad35643672bf74acc This converts all arrays that I could find that could clearly benefit from this without any other code changes being necessary. There were a few arrays that I didn't convert that seemed like they could be useful to convert, but where the variables started counting at 1. So by converting them elements the array would grow and elements would be shifted by one. Changing those might be nice, but would require some more code changes so I didn't want to combine it with these simpler refactors. The arrays I'm talking about were specifically tsearch_op_priority, BT_implies_table, BT_refutes_table, and BT_implic_table.
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