Simplify pg_enc2gettext_tbl[] with C99-designated initializer syntax

This commit switches pg_enc2gettext_tbl[] in encnames.c to use a
C99-designated initializer syntax.

pg_bind_textdomain_codeset() is simplified so as it is possible to do
a direct lookup at the gettext() array with a value of the enum pg_enc
rather than doing a loop through all its elements, as long as the
encoding value provided by GetDatabaseEncoding() is in the correct range
of supported encoding values.  Note that PG_MULE_INTERNAL gains a value
in the array, pointing to NULL.

Author: Jelte Fennema-Nio
Discussion: 
https://postgr.es/m/cageczqt3caubcccsznewccmmbcuyp7xnam60j3ybd6pn5kh...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/655dc310460c601d434d05339b7fa46ed97675b3

Modified Files
--------------
src/backend/utils/mb/mbutils.c   | 24 +++++------
src/common/encnames.c            | 86 ++++++++++++++++++++--------------------
src/include/mb/pg_wchar.h        | 11 ++---
src/tools/pgindent/typedefs.list |  1 -
4 files changed, 55 insertions(+), 67 deletions(-)

Reply via email to