pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rationalize code placement between wchar.c, encnames.c, and mbut
Date: Thu, 16 Jan 2020 23:08:30 +0000
Message-ID: <E1isEFa-000654-4y@gemulon.postgresql.org> (raw)

Rationalize code placement between wchar.c, encnames.c, and mbutils.c.

Move all the backend-only code that'd crept into wchar.c and encnames.c
into mbutils.c.

To remove the last few #ifdef dependencies from wchar.c and encnames.c,
also make the following changes:

* Adjust get_encoding_name_for_icu to return NULL, not throw an error,
for unsupported encodings.  Its sole caller can perfectly well throw an
error instead.  (While at it, I also made this function and its sibling
is_encoding_supported_by_icu proof against out-of-range encoding IDs.)

* Remove the overlength-name error condition from pg_char_to_encoding.
It's completely silly not to treat that just like any other
the-name-is-not-in-the-table case.

Also, get rid of pg_mic_mblen --- there's no obvious reason why
conv.c shouldn't call pg_mule_mblen instead.

Other than that, this is just code movement and comment-polishing with
no functional changes.  Notably, I reordered declarations in pg_wchar.h
to show which functions are frontend-accessible and which are not.

Discussion: https://postgr.es/m/CA+TgmoYO8oq-iy8E02rD8eX25T-9SmyxKWqqks5OMHxKvGXpXQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5afaa2e42655811461044c4216e2f821cadc766d

Modified Files
--------------
src/backend/utils/adt/pg_locale.c |   7 +-
src/backend/utils/mb/conv.c       |   4 +-
src/backend/utils/mb/mbutils.c    | 451 +++++++++++++++++++++++++++++++++++++-
src/common/encnames.c             |  83 ++-----
src/common/wchar.c                | 451 +-------------------------------------
src/include/mb/pg_wchar.h         |  45 ++--
6 files changed, 505 insertions(+), 536 deletions(-)



Message-ID: <E1isEFa-000654-4y@gemulon.postgresql.org>
Permalink:  ../E1isEFa-000654-4y@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1isEFa-000654-4y@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Rationalize code placement between wchar.c, encnames.c, and mbut
  In-Reply-To: <E1isEFa-000654-4y@gemulon.postgresql.org>
  References: <E1isEFa-000654-4y@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox