mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
mbcharlen() is now used instead of ismbhead(). The last one has been removed.
This commit is contained in:
parent
d5030a0541
commit
ca1a736296
18 changed files with 13 additions and 72 deletions
|
@ -131,7 +131,6 @@ typedef struct charset_info_st
|
|||
/* Multibyte routines */
|
||||
uint mbmaxlen;
|
||||
int (*ismbchar)(struct charset_info_st *, const char *, const char *);
|
||||
my_bool (*ismbhead)(struct charset_info_st *, uint);
|
||||
int (*mbcharlen)(struct charset_info_st *, uint);
|
||||
uint (*numchars)(struct charset_info_st *, const char *b, const char *e);
|
||||
uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
|
||||
|
@ -328,7 +327,6 @@ uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
|||
|
||||
#define use_mb(s) ((s)->ismbchar != NULL)
|
||||
#define my_ismbchar(s, a, b) ((s)->ismbchar((s), (a), (b)))
|
||||
#define my_ismbhead(s, a) ((s)->ismbhead((s), (a)))
|
||||
#define my_mbcharlen(s, a) ((s)->mbcharlen((s),(a)))
|
||||
|
||||
#define my_caseup(s, a, l) ((s)->caseup((s), (a), (l)))
|
||||
|
@ -336,7 +334,6 @@ uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
|
|||
#define my_caseup_str(s, a) ((s)->caseup_str((s), (a)))
|
||||
#define my_casedn_str(s, a) ((s)->casedn_str((s), (a)))
|
||||
#define my_strcasecmp(s, a, b) ((s)->strcasecmp((s), (a), (b)))
|
||||
#define my_strncasecmp(s, a, b, l) ((s)->strncasecmp((s), (a), (b), (l)))
|
||||
|
||||
#define my_strntol(s, a, b, c, d, e) ((s)->strntol((s),(a),(b),(c),(d),(e)))
|
||||
#define my_strntoul(s, a, b, c, d, e) ((s)->strntoul((s),(a),(b),(c),(d),(e)))
|
||||
|
|
|
@ -72,7 +72,7 @@ static void init_state_maps(CHARSET_INFO *cs)
|
|||
else if (my_isdigit(cs,i))
|
||||
state_map[i]=(uchar) MY_LEX_NUMBER_IDENT;
|
||||
#if defined(USE_MB) && defined(USE_MB_IDENT)
|
||||
else if (use_mb(cs) && my_ismbhead(cs, i))
|
||||
else if (use_mb(cs) && (my_mbcharlen(cs, i)>1))
|
||||
state_map[i]=(uchar) MY_LEX_IDENT;
|
||||
#endif
|
||||
else if (!my_isgraph(cs,i))
|
||||
|
|
|
@ -495,7 +495,7 @@ int yylex(void *arg, void *yythd)
|
|||
#if defined(USE_MB) && defined(USE_MB_IDENT)
|
||||
if (use_mb(cs))
|
||||
{
|
||||
if (my_ismbhead(cs, yyGetLast()))
|
||||
if (my_mbcharlen(cs, yyGetLast()) > 1)
|
||||
{
|
||||
int l = my_ismbchar(cs,
|
||||
(const char *)lex->ptr-1,
|
||||
|
@ -508,7 +508,7 @@ int yylex(void *arg, void *yythd)
|
|||
}
|
||||
while (ident_map[c=yyGet()])
|
||||
{
|
||||
if (my_ismbhead(cs, c))
|
||||
if (my_mbcharlen(cs, c) > 1)
|
||||
{
|
||||
int l;
|
||||
if ((l = my_ismbchar(cs,
|
||||
|
@ -604,7 +604,7 @@ int yylex(void *arg, void *yythd)
|
|||
#if defined(USE_MB) && defined(USE_MB_IDENT)
|
||||
if (use_mb(cs))
|
||||
{
|
||||
if (my_ismbhead(cs, yyGetLast()))
|
||||
if (my_mbcharlen(cs, yyGetLast()) > 1)
|
||||
{
|
||||
int l = my_ismbchar(cs,
|
||||
(const char *)lex->ptr-1,
|
||||
|
@ -618,7 +618,7 @@ int yylex(void *arg, void *yythd)
|
|||
}
|
||||
while (ident_map[c=yyGet()])
|
||||
{
|
||||
if (my_ismbhead(cs, c))
|
||||
if (my_mbcharlen(cs, c) > 1)
|
||||
{
|
||||
int l;
|
||||
if ((l = my_ismbchar(cs,
|
||||
|
@ -650,7 +650,7 @@ int yylex(void *arg, void *yythd)
|
|||
{
|
||||
while ((c=yyGet()) && c != delim && c != (uchar) NAMES_SEP_CHAR)
|
||||
{
|
||||
if (my_ismbhead(cs, c))
|
||||
if (my_mbcharlen(cs, c) > 1)
|
||||
{
|
||||
int l;
|
||||
if ((l = my_ismbchar(cs,
|
||||
|
|
|
@ -702,7 +702,7 @@ int READ_INFO::read_field()
|
|||
chr = GET;
|
||||
#ifdef USE_MB
|
||||
if (use_mb(read_charset) &&
|
||||
my_ismbhead(read_charset, chr) &&
|
||||
(my_mbcharlen(read_charset, chr) >1 )&&
|
||||
to+my_mbcharlen(read_charset, chr) <= end_of_buff)
|
||||
{
|
||||
uchar* p = (uchar*)to;
|
||||
|
@ -884,7 +884,7 @@ int READ_INFO::next_line()
|
|||
{
|
||||
int chr = GET;
|
||||
#ifdef USE_MB
|
||||
if (use_mb(read_charset) && my_ismbhead(read_charset, chr))
|
||||
if (use_mb(read_charset) && (my_mbcharlen(read_charset, chr) >1 ))
|
||||
{
|
||||
for (int i=1;
|
||||
chr != my_b_EOF && i<my_mbcharlen(read_charset, chr);
|
||||
|
|
|
@ -399,11 +399,6 @@ static int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
|
|||
return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0);
|
||||
}
|
||||
|
||||
static my_bool ismbhead_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
|
||||
{
|
||||
return isbig5head(c);
|
||||
}
|
||||
|
||||
static int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
|
||||
{
|
||||
return (isbig5head(c)? 2: 0);
|
||||
|
@ -6253,7 +6248,6 @@ CHARSET_INFO my_charset_big5 =
|
|||
my_wildcmp_mb,
|
||||
2, /* mbmaxlen */
|
||||
ismbchar_big5,
|
||||
ismbhead_big5,
|
||||
mbcharlen_big5,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -284,7 +284,6 @@ CHARSET_INFO my_charset_bin =
|
|||
my_wildcmp_bin, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
NULL, /* ismbhead */
|
||||
NULL, /* mbcharlen */
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
|
|
@ -627,7 +627,6 @@ CHARSET_INFO my_charset_czech =
|
|||
my_wildcmp_8bit,
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
NULL, /* ismbhead */
|
||||
NULL, /* mbcharlen */
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
|
|
@ -191,11 +191,6 @@ static int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
|
|||
0);
|
||||
}
|
||||
|
||||
static my_bool ismbhead_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (iseuc_kr(c));
|
||||
}
|
||||
|
||||
static int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (iseuc_kr(c) ? 2 : 0);
|
||||
|
@ -8661,7 +8656,6 @@ CHARSET_INFO my_charset_euc_kr =
|
|||
my_wildcmp_mb, /* wildcmp */
|
||||
2, /* mbmaxlen */
|
||||
ismbchar_euc_kr,
|
||||
ismbhead_euc_kr,
|
||||
mbcharlen_euc_kr,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -42,7 +42,6 @@ CHARSET_INFO compiled_charsets[] = {
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, /* mb_wc */
|
||||
NULL, /* wc_mb */
|
||||
|
||||
|
|
|
@ -172,11 +172,6 @@ static int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)),
|
|||
return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0);
|
||||
}
|
||||
|
||||
static my_bool ismbhead_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return isgb2312head(c);
|
||||
}
|
||||
|
||||
static int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isgb2312head(c)? 2:0);
|
||||
|
@ -5711,7 +5706,6 @@ CHARSET_INFO my_charset_gb2312 =
|
|||
my_wildcmp_mb, /* wildcmp */
|
||||
2, /* mbmaxlen */
|
||||
ismbchar_gb2312,
|
||||
ismbhead_gb2312,
|
||||
mbcharlen_gb2312,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -2619,7 +2619,7 @@ int my_strnncollsp_gbk(CHARSET_INFO * cs,
|
|||
}
|
||||
|
||||
|
||||
int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
static int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
uchar * dest, uint len,
|
||||
const uchar * src, uint srclen)
|
||||
{
|
||||
|
@ -2661,7 +2661,7 @@ int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
|||
|
||||
#define max_sort_char ((uchar) 255)
|
||||
|
||||
extern my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr,uint ptr_length,
|
||||
int escape, int w_one, int w_many,
|
||||
uint res_length, char *min_str,char *max_str,
|
||||
|
@ -2713,18 +2713,13 @@ extern my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
|||
}
|
||||
|
||||
|
||||
int ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
static int ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
return (isgbkhead(*(p)) && (e)-(p)>1 && isgbktail(*((p)+1))? 2: 0);
|
||||
}
|
||||
|
||||
my_bool ismbhead_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return isgbkhead(c);
|
||||
}
|
||||
|
||||
int mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
static int mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isgbkhead(c)? 2:0);
|
||||
}
|
||||
|
@ -9908,7 +9903,6 @@ CHARSET_INFO my_charset_gbk =
|
|||
my_wildcmp_mb, /* wildcmp */
|
||||
2, /* mbmaxlen */
|
||||
ismbchar_gbk,
|
||||
ismbhead_gbk,
|
||||
mbcharlen_gbk,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -197,7 +197,6 @@ CHARSET_INFO my_charset_latin1 =
|
|||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
NULL, /* ismbhead */
|
||||
NULL, /* mbcharlen */
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
@ -451,7 +450,6 @@ CHARSET_INFO my_charset_latin1_de =
|
|||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
NULL, /* ismbhead */
|
||||
NULL, /* mbcharlen */
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
|
|
@ -107,7 +107,7 @@ int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)
|
|||
if (*s++ != *t++)
|
||||
return 1;
|
||||
}
|
||||
else if (my_ismbhead(cs, *t))
|
||||
else if (my_mbcharlen(cs, *t) > 1)
|
||||
return 1;
|
||||
else if (map[(uchar) *s++] != map[(uchar) *t++])
|
||||
return 1;
|
||||
|
|
|
@ -189,11 +189,6 @@ static int ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
return (issjishead((uchar) *p) && (e-p)>1 && issjistail((uchar)p[1]) ? 2: 0);
|
||||
}
|
||||
|
||||
static my_bool ismbhead_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return issjishead((uchar) c);
|
||||
}
|
||||
|
||||
static int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (issjishead((uchar) c) ? 2: 0);
|
||||
|
@ -4495,7 +4490,6 @@ CHARSET_INFO my_charset_sjis =
|
|||
my_wildcmp_mb, /* wildcmp */
|
||||
2, /* mbmaxlen */
|
||||
ismbchar_sjis,
|
||||
ismbhead_sjis,
|
||||
mbcharlen_sjis,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -718,7 +718,6 @@ CHARSET_INFO my_charset_tis620 =
|
|||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
NULL, /* ismbhead */
|
||||
NULL, /* mbcharlen */
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
|
|
@ -194,11 +194,6 @@ static int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
0);
|
||||
}
|
||||
|
||||
static my_bool ismbhead_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isujis(c) || isujis_ss2(c) || isujis_ss3(c));
|
||||
}
|
||||
|
||||
static int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0);
|
||||
|
@ -8452,7 +8447,6 @@ CHARSET_INFO my_charset_ujis =
|
|||
my_wildcmp_mb, /* wildcmp */
|
||||
3, /* mbmaxlen */
|
||||
ismbchar_ujis,
|
||||
ismbhead_ujis,
|
||||
mbcharlen_ujis,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -1929,11 +1929,6 @@ static int my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)
|
|||
return (res>1) ? res : 0;
|
||||
}
|
||||
|
||||
static my_bool my_ismbhead_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint ch)
|
||||
{
|
||||
return ( ch >= 0xc2 );
|
||||
}
|
||||
|
||||
static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c)
|
||||
{
|
||||
if (c < 0x80)
|
||||
|
@ -1977,7 +1972,6 @@ CHARSET_INFO my_charset_utf8 =
|
|||
my_wildcmp_mb, /* wildcmp */
|
||||
3, /* mbmaxlen */
|
||||
my_ismbchar_utf8, /* ismbchar */
|
||||
my_ismbhead_utf8, /* ismbhead */
|
||||
my_mbcharlen_utf8, /* mbcharlen */
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
@ -2325,12 +2319,6 @@ static int my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
|||
return 2;
|
||||
}
|
||||
|
||||
static my_bool my_ismbhead_ucs2(CHARSET_INFO *cs __attribute__((unused)) ,
|
||||
uint ch __attribute__((unused)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) ,
|
||||
uint c __attribute__((unused)))
|
||||
{
|
||||
|
@ -3059,7 +3047,6 @@ CHARSET_INFO my_charset_ucs2 =
|
|||
my_wildcmp_mb, /* wildcmp */
|
||||
2, /* mbmaxlen */
|
||||
my_ismbchar_ucs2, /* ismbchar */
|
||||
my_ismbhead_ucs2, /* ismbhead */
|
||||
my_mbcharlen_ucs2, /* mbcharlen */
|
||||
my_numchars_ucs2,
|
||||
my_charpos_ucs2,
|
||||
|
|
|
@ -662,7 +662,6 @@ CHARSET_INFO my_charset_win1250ch =
|
|||
my_wildcmp_8bit, /* wildcmp */
|
||||
1, /* mbmaxlen */
|
||||
NULL, /* ismbchar */
|
||||
NULL, /* ismbhead */
|
||||
NULL, /* mbcharlen */
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
|
Loading…
Reference in a new issue