>From 9431faf6172b7e6557d9b7f16f4df12210d58d32 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 20 May 2018 12:59:01 +0200 Subject: [PATCH 5/5] localcharset: Optimize. * lib/localcharset.c (alias_table): Comment out no-op mappings for platforms where these don't matter. This reduces the table size, which in turn reduces the lookup time. --- ChangeLog | 7 +++++++ lib/localcharset.c | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a02c1a..86c2863 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-05-20 Bruno Haible + + localcharset: Optimize. + * lib/localcharset.c (alias_table): Comment out no-op mappings for + platforms where these don't matter. This reduces the table size, + which in turn reduces the lookup time. + 2018-05-19 Bruno Haible localcharset: Map the locale encodings found in newer OSes. diff --git a/lib/localcharset.c b/lib/localcharset.c index 60c320a..a51eb0b 100644 --- a/lib/localcharset.c +++ b/lib/localcharset.c @@ -90,15 +90,15 @@ struct table_entry static const struct table_entry alias_table[] = { # if defined __FreeBSD__ /* FreeBSD */ - { "ARMSCII-8", "ARMSCII-8" }, + /*{ "ARMSCII-8", "ARMSCII-8" },*/ { "Big5", "BIG5" }, { "C", "ASCII" }, - { "CP1131", "CP1131" }, - { "CP1251", "CP1251" }, - { "CP866", "CP866" }, - { "GB18030", "GB18030" }, - { "GB2312", "GB2312" }, - { "GBK", "GBK" }, + /*{ "CP1131", "CP1131" },*/ + /*{ "CP1251", "CP1251" },*/ + /*{ "CP866", "CP866" },*/ + /*{ "GB18030", "GB18030" },*/ + /*{ "GB2312", "GB2312" },*/ + /*{ "GBK", "GBK" },*/ /*{ "ISCII-DEV", "?" },*/ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-13", "ISO-8859-13" }, @@ -107,8 +107,8 @@ static const struct table_entry alias_table[] = { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, { "ISO8859-9", "ISO-8859-9" }, - { "KOI8-R", "KOI8-R" }, - { "KOI8-U", "KOI8-U" }, + /*{ "KOI8-R", "KOI8-R" },*/ + /*{ "KOI8-U", "KOI8-U" },*/ { "SJIS", "SHIFT_JIS" }, { "US-ASCII", "ASCII" }, { "eucCN", "GB2312" }, @@ -118,13 +118,13 @@ static const struct table_entry alias_table[] = # endif # if defined __NetBSD__ /* NetBSD */ { "646", "ASCII" }, - { "ARMSCII-8", "ARMSCII-8" }, - { "BIG5", "BIG5" }, + /*{ "ARMSCII-8", "ARMSCII-8" },*/ + /*{ "BIG5", "BIG5" },*/ { "Big5-HKSCS", "BIG5-HKSCS" }, - { "CP1251", "CP1251" }, - { "CP866", "CP866" }, - { "GB18030", "GB18030" }, - { "GB2312", "GB2312" }, + /*{ "CP1251", "CP1251" },*/ + /*{ "CP866", "CP866" },*/ + /*{ "GB18030", "GB18030" },*/ + /*{ "GB2312", "GB2312" },*/ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-13", "ISO-8859-13" }, { "ISO8859-15", "ISO-8859-15" }, @@ -132,9 +132,9 @@ static const struct table_entry alias_table[] = { "ISO8859-4", "ISO-8859-4" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, - { "KOI8-R", "KOI8-R" }, - { "KOI8-U", "KOI8-U" }, - { "PT154", "PT154" }, + /*{ "KOI8-R", "KOI8-R" },*/ + /*{ "KOI8-U", "KOI8-U" },*/ + /*{ "PT154", "PT154" },*/ { "SJIS", "SHIFT_JIS" }, { "eucCN", "GB2312" }, { "eucJP", "EUC-JP" }, @@ -216,7 +216,7 @@ static const struct table_entry alias_table[] = # define alias_table_defined # endif # if defined _AIX /* AIX */ - { "GBK", "GBK" }, + /*{ "GBK", "GBK" },*/ { "IBM-1046", "CP1046" }, { "IBM-1124", "CP1124" }, { "IBM-1129", "CP1129" }, @@ -240,7 +240,7 @@ static const struct table_entry alias_table[] = { "ISO8859-8", "ISO-8859-8" }, { "ISO8859-9", "ISO-8859-9" }, { "TIS-620", "TIS-620" }, - { "UTF-8", "UTF-8" }, + /*{ "UTF-8", "UTF-8" },*/ { "big5", "BIG5" } # define alias_table_defined # endif @@ -289,7 +289,7 @@ static const struct table_entry alias_table[] = # define alias_table_defined # endif # if defined __osf__ /* OSF/1 */ - { "GBK", "GBK" }, + /*{ "GBK", "GBK" },*/ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, @@ -301,7 +301,7 @@ static const struct table_entry alias_table[] = { "KSC5601", "CP949" }, { "SJIS", "SHIFT_JIS" }, { "TACTIS", "TIS-620" }, - { "UTF-8", "UTF-8" }, + /*{ "UTF-8", "UTF-8" },*/ { "big5", "BIG5" }, { "cp850", "CP850" }, { "dechanyu", "DEC-HANYU" }, @@ -317,10 +317,10 @@ static const struct table_entry alias_table[] = # if defined __sun /* Solaris */ { "5601", "EUC-KR" }, { "646", "ASCII" }, - { "BIG5", "BIG5" }, + /*{ "BIG5", "BIG5" },*/ { "Big5-HKSCS", "BIG5-HKSCS" }, { "GB18030", "GB18030" }, - { "GBK", "GBK" }, + /*{ "GBK", "GBK" },*/ { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-11", "TIS-620" }, { "ISO8859-13", "ISO-8859-13" }, @@ -335,7 +335,7 @@ static const struct table_entry alias_table[] = { "ISO8859-9", "ISO-8859-9" }, { "PCK", "SHIFT_JIS" }, { "TIS620.2533", "TIS-620" }, - { "UTF-8", "UTF-8" }, + /*{ "UTF-8", "UTF-8" },*/ { "ansi-1251", "CP1251" }, { "cns11643", "EUC-TW" }, { "eucJP", "EUC-JP" }, -- 2.7.4