diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-03-16 10:55:12 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2016-03-16 10:55:12 +0400 |
commit | e09299511e83f11f7476f7ea6c81ee12b00d7050 (patch) | |
tree | a3544293e29a5d191f2b07ce1810f58e257b1b10 /strings | |
parent | dc08ccab422098d2466fa342d577f03c941a4ffc (diff) | |
download | mariadb-git-e09299511e83f11f7476f7ea6c81ee12b00d7050.tar.gz |
MDEV-9665 Remove cs->cset->ismbchar()
Using a more powerfull cs->cset->charlen() instead.
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-big5.c | 14 | ||||
-rw-r--r-- | strings/ctype-bin.c | 1 | ||||
-rw-r--r-- | strings/ctype-cp932.c | 7 | ||||
-rw-r--r-- | strings/ctype-euc_kr.c | 9 | ||||
-rw-r--r-- | strings/ctype-eucjpms.c | 11 | ||||
-rw-r--r-- | strings/ctype-gb2312.c | 7 | ||||
-rw-r--r-- | strings/ctype-gbk.c | 13 | ||||
-rw-r--r-- | strings/ctype-latin1.c | 1 | ||||
-rw-r--r-- | strings/ctype-mb.c | 5 | ||||
-rw-r--r-- | strings/ctype-simple.c | 1 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 7 | ||||
-rw-r--r-- | strings/ctype-tis620.c | 1 | ||||
-rw-r--r-- | strings/ctype-ucs2.c | 32 | ||||
-rw-r--r-- | strings/ctype-ujis.c | 11 | ||||
-rw-r--r-- | strings/ctype-utf8.c | 26 |
15 files changed, 9 insertions, 137 deletions
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index d6a9695afbf..3351fb6ef2f 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -862,12 +862,12 @@ my_strnxfrm_big5(CHARSET_INFO *cs, for (; dst < de && src < se && nweights; nweights--) { - if (cs->cset->ismbchar(cs, (const char*) src, (const char*) se)) + if (my_charlen(cs, src, se) > 1) { /* Note, it is safe not to check (src < se) - in the code below, because ismbchar() would - not return TRUE if src was too short + in the code below, because my_charlen() would + not return 2 if src was too short */ uint16 e= big5strokexfrm((uint16) big5code(*src, *(src + 1))); *dst++= big5head(e); @@ -930,13 +930,6 @@ static int my_strxfrm_big5(uchar *dest, const uchar *src, int len) #endif -static uint ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) -{ - return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0); -} - - static uint mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c) { return (isbig5head(c)? 2 : 1); @@ -6818,7 +6811,6 @@ static MY_COLLATION_HANDLER my_collation_handler_big5_bin= static MY_CHARSET_HANDLER my_charset_big5_handler= { NULL, /* init */ - ismbchar_big5, mbcharlen_big5, my_numchars_mb, my_charpos_mb, diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 0be6ae95577..1027255af55 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -521,7 +521,6 @@ static MY_COLLATION_HANDLER my_collation_binary_handler = static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - NULL, /* ismbchar */ my_mbcharlen_8bit, /* mbcharlen */ my_numchars_8bit, my_charpos_8bit, diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index 9bf206f1de7..2163662269d 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -191,12 +191,6 @@ static const uchar sort_order_cp932[]= #include "ctype-mb.ic" -static uint ismbchar_cp932(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) -{ - return (iscp932head((uchar) *p) && (e-p)>1 && iscp932tail((uchar)p[1]) ? 2: 0); -} - static uint mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (iscp932head((uchar) c) ? 2 : 1); @@ -34693,7 +34687,6 @@ static MY_COLLATION_HANDLER my_collation_handler_cp932_bin= static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - ismbchar_cp932, mbcharlen_cp932, my_numchars_mb, my_charpos_mb, diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 1f13ab66284..19ed586ea49 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -210,14 +210,6 @@ static const uchar sort_order_euc_kr[]= #include "ctype-mb.ic" -static uint ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) -{ - return ((*(uchar*)(p)<0x80)? 0:\ - iseuc_kr_head(*(p)) && (e)-(p)>1 && iseuc_kr_tail(*((p)+1))? 2:\ - 0); -} - static uint mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (iseuc_kr_head(c) ? 2 : 1); @@ -9987,7 +9979,6 @@ static MY_COLLATION_HANDLER my_collation_handler_euckr_bin= static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - ismbchar_euc_kr, mbcharlen_euc_kr, my_numchars_mb, my_charpos_mb, diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index 82c4bb5a4e8..52494b7dfb3 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -220,16 +220,6 @@ static const uchar sort_order_eucjpms[]= #include "strcoll.ic" -static uint ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) -{ - return ((*(uchar*)(p)<0x80)? 0:\ - iseucjpms(*(p)) && (e)-(p)>1 && iseucjpms(*((p)+1))? 2:\ - iseucjpms_ss2(*(p)) && (e)-(p)>1 && iskata(*((p)+1))? 2:\ - iseucjpms_ss3(*(p)) && (e)-(p)>2 && iseucjpms(*((p)+1)) && iseucjpms(*((p)+2))? 3:\ - 0); -} - static uint mbcharlen_eucjpms(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (iseucjpms(c)? 2: iseucjpms_ss2(c)? 2: iseucjpms_ss3(c)? 3: 1); @@ -67520,7 +67510,6 @@ static MY_COLLATION_HANDLER my_collation_eucjpms_bin_handler = static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - ismbchar_eucjpms, mbcharlen_eucjpms, my_numchars_mb, my_charpos_mb, diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index b0e275fe93d..a77237c1791 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -173,12 +173,6 @@ static const uchar sort_order_gb2312[]= #include "ctype-mb.ic" -static uint ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) -{ - return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0); -} - static uint mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (isgb2312head(c)? 2 : 1); @@ -6391,7 +6385,6 @@ static MY_COLLATION_HANDLER my_collation_handler_gb2312_bin= static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - ismbchar_gb2312, mbcharlen_gb2312, my_numchars_mb, my_charpos_mb, diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 37b003f1899..b617a759718 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -3463,12 +3463,12 @@ my_strnxfrm_gbk(CHARSET_INFO *cs, for (; dst < de && src < se && nweights; nweights--) { - if (cs->cset->ismbchar(cs, (const char*) src, (const char*) se)) + if (my_charlen(cs, src, se) > 1) { /* Note, it is safe not to check (src < se) - in the code below, because ismbchar() would - not return TRUE if src was too short + in the code below, because my_charlen() would + not return 2 if src was too short */ uint16 e= gbksortorder((uint16) gbkcode(*src, *(src + 1))); *dst++= gbkhead(e); @@ -3483,12 +3483,6 @@ my_strnxfrm_gbk(CHARSET_INFO *cs, } -static uint ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) -{ - return (isgbkhead(*(p)) && (e)-(p)>1 && isgbktail(*((p)+1))? 2: 0); -} - static uint mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (isgbkhead(c)? 2 : 1); @@ -10703,7 +10697,6 @@ static MY_COLLATION_HANDLER my_collation_handler_gbk_bin= static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - ismbchar_gbk, mbcharlen_gbk, my_numchars_mb, my_charpos_mb, diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 26c66d60071..cf8f9bb7e28 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -396,7 +396,6 @@ int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)), static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - NULL, my_mbcharlen_8bit, my_numchars_8bit, my_charpos_8bit, diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index eef283d2925..ad2b7d0d36f 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -668,7 +668,7 @@ my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), */ #define my_strnxfrm_mb_non_ascii_char(cs, dst, src, se) \ { \ - switch (cs->cset->ismbchar(cs, (const char*) src, (const char*) se)) { \ + switch (my_ismbchar(cs, src, se)) { \ case 4: \ *dst++= *src++; \ /* fall through */ \ @@ -740,8 +740,7 @@ my_strnxfrm_mb(CHARSET_INFO *cs, for (; src < se && nweights && dst < de; nweights--) { int chlen; - if (*src < 128 || - !(chlen= cs->cset->ismbchar(cs, (const char*) src, (const char*) se))) + if (*src < 128 || !(chlen= my_ismbchar(cs, src, se))) { /* Single byte character */ *dst++= sort_order ? sort_order[*src++] : *src++; diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 288f5fdd49d..b205b1abc20 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -1926,7 +1926,6 @@ my_strxfrm_pad_desc_and_reverse(CHARSET_INFO *cs, MY_CHARSET_HANDLER my_charset_8bit_handler= { my_cset_init_8bit, - NULL, /* ismbchar */ my_mbcharlen_8bit, /* mbcharlen */ my_numchars_8bit, my_charpos_8bit, diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 629e1cd8309..ebcea22d242 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -192,12 +192,6 @@ static const uchar sort_order_sjis[]= #include "ctype-mb.ic" -static uint ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) -{ - return (issjishead((uchar) *p) && (e-p)>1 && issjistail((uchar)p[1]) ? 2: 0); -} - static uint mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (issjishead((uchar) c) ? 2 : 1); @@ -34072,7 +34066,6 @@ static MY_COLLATION_HANDLER my_collation_handler_sjis_bin= static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - ismbchar_sjis, mbcharlen_sjis, my_numchars_mb, my_charpos_mb, diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index a1ca320835d..6315b05ea96 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -860,7 +860,6 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - NULL, /* ismbchar */ my_mbcharlen_8bit, /* mbcharlen */ my_numchars_8bit, my_charpos_8bit, diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index cae85f38c12..74e474cc28c 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1413,15 +1413,6 @@ my_casedn_utf16(CHARSET_INFO *cs, char *src, size_t srclen, } -static uint -my_ismbchar_utf16(CHARSET_INFO *cs, const char *b, const char *e) -{ - my_wc_t wc; - int res= cs->cset->mb_wc(cs, &wc, (const uchar *) b, (const uchar *) e); - return (uint) (res > 0 ? res : 0); -} - - static int my_charlen_utf16(CHARSET_INFO *cs, const uchar *str, const uchar *end) { @@ -1456,7 +1447,7 @@ my_numchars_utf16(CHARSET_INFO *cs, size_t nchars= 0; for ( ; ; nchars++) { - size_t charlen= my_ismbchar_utf16(cs, b, e); + size_t charlen= my_ismbchar(cs, b, e); if (!charlen) break; b+= charlen; @@ -1576,7 +1567,6 @@ static MY_COLLATION_HANDLER my_collation_utf16_bin_handler = MY_CHARSET_HANDLER my_charset_utf16_handler= { NULL, /* init */ - my_ismbchar_utf16, /* ismbchar */ my_mbcharlen_utf16, /* mbcharlen */ my_numchars_utf16, my_charpos_utf16, @@ -1799,7 +1789,6 @@ static MY_COLLATION_HANDLER my_collation_utf16le_bin_handler = static MY_CHARSET_HANDLER my_charset_utf16le_handler= { NULL, /* init */ - my_ismbchar_utf16, my_mbcharlen_utf16, my_numchars_utf16, my_charpos_utf16, @@ -2075,15 +2064,6 @@ my_casedn_utf32(CHARSET_INFO *cs, char *src, size_t srclen, } -static uint -my_ismbchar_utf32(CHARSET_INFO *cs __attribute__((unused)), - const char *b, - const char *e) -{ - return b + 4 > e || !IS_UTF32_MBHEAD4(b[0], b[1]) ? 0 : 4; -} - - static int my_charlen_utf32(CHARSET_INFO *cs __attribute__((unused)), const uchar *b, const uchar *e) @@ -2545,7 +2525,6 @@ static MY_COLLATION_HANDLER my_collation_utf32_bin_handler = MY_CHARSET_HANDLER my_charset_utf32_handler= { NULL, /* init */ - my_ismbchar_utf32, my_mbcharlen_utf32, my_numchars_utf32, my_charpos_utf32, @@ -2883,14 +2862,6 @@ my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)), } -static uint my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *b, - const char *e) -{ - return b + 2 > e ? 0 : 2; -} - - static uint my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) , uint c __attribute__((unused))) { @@ -3032,7 +3003,6 @@ static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler = MY_CHARSET_HANDLER my_charset_ucs2_handler= { NULL, /* init */ - my_ismbchar_ucs2, /* ismbchar */ my_mbcharlen_ucs2, /* mbcharlen */ my_numchars_ucs2, my_charpos_ucs2, diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 308f5f0f7d1..67e68901573 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -219,16 +219,6 @@ static const uchar sort_order_ujis[]= #include "strcoll.ic" -static uint ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)), - const char* p, const char *e) -{ - return ((*(uchar*)(p)<0x80)? 0:\ - isujis(*(p)) && (e)-(p)>1 && isujis(*((p)+1))? 2:\ - isujis_ss2(*(p)) && (e)-(p)>1 && iskata(*((p)+1))? 2:\ - isujis_ss3(*(p)) && (e)-(p)>2 && isujis(*((p)+1)) && isujis(*((p)+2))? 3:\ - 0); -} - static uint mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c) { return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 1); @@ -67264,7 +67254,6 @@ static MY_COLLATION_HANDLER my_collation_ujis_bin_handler = static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ - ismbchar_ujis, mbcharlen_ujis, my_numchars_mb, my_charpos_mb, diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index c0865157ad5..c0014b95d15 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -5426,12 +5426,6 @@ my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2) #include "strcoll.ic" -static uint my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e) -{ - int res= my_charlen_utf8(cs, (const uchar*) b, (const uchar*) e); - return (res>1) ? res : 0; -} - static uint my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)), uint c) { @@ -5497,7 +5491,6 @@ static MY_COLLATION_HANDLER my_collation_utf8_bin_handler = MY_CHARSET_HANDLER my_charset_utf8_handler= { NULL, /* init */ - my_ismbchar_utf8, my_mbcharlen_utf8, my_numchars_mb, my_charpos_mb, @@ -7044,15 +7037,6 @@ my_charlen_filename(CHARSET_INFO *cs, const uchar *str, const uchar *end) } -static uint -my_ismbchar_filename(CHARSET_INFO *cs, const char *str, const char *end) -{ - my_wc_t wc; - int rc= my_mb_wc_filename(cs, &wc, (const uchar *) str, (const uchar *) end); - return rc > 1 ? rc : 0; -} - - #define MY_FUNCTION_NAME(x) my_ ## x ## _filename #define CHARLEN(cs,str,end) my_charlen_filename(cs,str,end) #define DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN @@ -7081,7 +7065,6 @@ static MY_COLLATION_HANDLER my_collation_filename_handler = static MY_CHARSET_HANDLER my_charset_filename_handler= { NULL, /* init */ - my_ismbchar_filename, my_mbcharlen_utf8, my_numchars_mb, my_charpos_mb, @@ -7793,14 +7776,6 @@ size_t my_well_formed_len_utf8mb4(CHARSET_INFO *cs, static uint -my_ismbchar_utf8mb4(CHARSET_INFO *cs, const char *b, const char *e) -{ - int res= my_charlen_utf8mb4(cs, (const uchar*) b, (const uchar*) e); - return (res > 1) ? res : 0; -} - - -static uint my_mbcharlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), uint c) { if (c < 0x80) @@ -7852,7 +7827,6 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler = MY_CHARSET_HANDLER my_charset_utf8mb4_handler= { NULL, /* init */ - my_ismbchar_utf8mb4, my_mbcharlen_utf8mb4, my_numchars_mb, my_charpos_mb, |