Re: Improve readability by using designated initializers when possible

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Jelte Fennema-Nio <postgres@jeltef.nl>
Cc: Japin Li <japinli@hotmail.com>, jian he <jian.universality@gmail.com>, Jeff Davis <pgsql@j-davis.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Alvaro Herrera <alvherre@alvh.no-ip.org>, pgsql-hackers@lists.postgresql.org
Date: 2024-03-01T05:08:40Z
Lists: pgsql-hackers
On Fri, Mar 01, 2024 at 05:34:05AM +0100, Jelte Fennema-Nio wrote:

> diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h
> index fd91aefbcb7..32e25a1a6ea 100644
> --- a/src/include/mb/pg_wchar.h
> +++ b/src/include/mb/pg_wchar.h
> @@ -225,7 +225,8 @@ typedef unsigned int pg_wchar;
>   * PostgreSQL encoding identifiers
>   *
>   * WARNING: If you add some encoding don't forget to update
> - *			the pg_enc2name_tbl[] array (in src/common/encnames.c) and
> + *			the pg_enc2name_tbl[] array (in src/common/encnames.c),
> + *			the pg_enc2gettext_tbl[] array (in src/common/encnames.c) and
>   *			the pg_wchar_table[] array (in src/common/wchar.c) and to check
>   *			PG_ENCODING_BE_LAST macro.

Mostly OK to me.  Just note that this comment is incorrect because
pg_enc2gettext_tbl[] includes elements in the range
[PG_SJIS,_PG_LAST_ENCODING_[  ;)
--
Michael

Commits

  1. Remove ObjectClass type

  2. Simplify pg_enc2gettext_tbl[] with C99-designated initializer syntax

  3. Use C99-designated initializer syntax for arrays related to encodings

  4. Remove last NULL element in config_group_names[]

  5. Use C99-designated initializer syntax for more arrays

  6. Remove unnecessary array object_classes[] in dependency.c

  7. Add trailing commas to enum definitions