diff options
author | Michael Paquier | 2024-02-29 00:54:25 +0000 |
---|---|---|
committer | Michael Paquier | 2024-02-29 00:54:25 +0000 |
commit | ada87a4d95fc39dfb1214edf6653390314b6f0df (patch) | |
tree | fb070a1acf4e649f1d6adb86116263329505f28f /src/include/mb/pg_wchar.h | |
parent | e8aecc5c2ce1d3b2b1b01bd770c14f5214c2a369 (diff) |
Use C99-designated initializer syntax for arrays related to encodings
This updates the following lookup arrays to use C99-designated
initializer syntax, indexed based on the enum pg_enc:
pg_enc2icu_tbl[]
pg_enc2name_tbl[]
pg_wchar_table[]
This is more readable, and removes problems with ordering mistakes as
this removes dependencies between the arrays and their lookup index in
the enum pg_enc. So, adding new encodings becomes easier, even if this
does not happen often.
Author: Jelte Fennema-Nio
Reviewed-by: Jian He, Japin Li
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com
Diffstat (limited to 'src/include/mb/pg_wchar.h')
-rw-r--r-- | src/include/mb/pg_wchar.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h index 1d521bea24a..fd91aefbcb7 100644 --- a/src/include/mb/pg_wchar.h +++ b/src/include/mb/pg_wchar.h @@ -224,11 +224,9 @@ typedef unsigned int pg_wchar; /* * PostgreSQL encoding identifiers * - * WARNING: the order of this enum must be same as order of entries - * in the pg_enc2name_tbl[] array (in src/common/encnames.c), and - * in the pg_wchar_table[] array (in src/common/wchar.c)! - * - * If you add some encoding don't forget to check + * WARNING: If you add some encoding don't forget to update + * the pg_enc2name_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. * * PG_SQL_ASCII is default encoding and must be = 0. |