Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5afaa2e

Browse files
committed
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.cinto 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 anerror instead. (While at it, I also made this function and its siblingis_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 otherthe-name-is-not-in-the-table case.Also, get rid of pg_mic_mblen --- there's no obvious reason whyconv.c shouldn't call pg_mule_mblen instead.Other than that, this is just code movement and comment-polishing withno functional changes. Notably, I reordered declarations in pg_wchar.hto show which functions are frontend-accessible and which are not.Discussion:https://postgr.es/m/CA+TgmoYO8oq-iy8E02rD8eX25T-9SmyxKWqqks5OMHxKvGXpXQ@mail.gmail.com
1 parent3d4cb5d commit5afaa2e

File tree

6 files changed

+505
-536
lines changed

6 files changed

+505
-536
lines changed

‎src/backend/utils/adt/pg_locale.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,9 +1555,14 @@ init_icu_converter(void)
15551555
UConverter*conv;
15561556

15571557
if (icu_converter)
1558-
return;
1558+
return;/* already done */
15591559

15601560
icu_encoding_name=get_encoding_name_for_icu(GetDatabaseEncoding());
1561+
if (!icu_encoding_name)
1562+
ereport(ERROR,
1563+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1564+
errmsg("encoding \"%s\" not supported by ICU",
1565+
pg_encoding_to_char(GetDatabaseEncoding()))));
15611566

15621567
status=U_ZERO_ERROR;
15631568
conv=ucnv_open(icu_encoding_name,&status);

‎src/backend/utils/mb/conv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ mic2latin(const unsigned char *mic, unsigned char *p, int len,
115115
}
116116
else
117117
{
118-
intl=pg_mic_mblen(mic);
118+
intl=pg_mule_mblen(mic);
119119

120120
if (len<l)
121121
report_invalid_encoding(PG_MULE_INTERNAL, (constchar*)mic,
@@ -217,7 +217,7 @@ mic2latin_with_table(const unsigned char *mic,
217217
}
218218
else
219219
{
220-
intl=pg_mic_mblen(mic);
220+
intl=pg_mule_mblen(mic);
221221

222222
if (len<l)
223223
report_invalid_encoding(PG_MULE_INTERNAL, (constchar*)mic,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp