summaryrefslogtreecommitdiff
path: root/strings/ctype-utf8.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-10-30 13:02:59 +0100
committerSergei Golubchik <serg@mariadb.org>2018-10-30 15:10:01 +0100
commit44f6f445933e12cbc4cce63e2b7d983b9938d3b9 (patch)
treef5230fb24510bb201eb33122a62939ce74588b83 /strings/ctype-utf8.c
parent8772824ce72a811ea92dd5cfb73602eb93237891 (diff)
parentf4b8b6b9a3ad4ce5e5218e2ec2dfe6dd34112e45 (diff)
downloadmariadb-git-44f6f445933e12cbc4cce63e2b7d983b9938d3b9.tar.gz
Merge branch '10.0' into 10.1
Diffstat (limited to 'strings/ctype-utf8.c')
-rw-r--r--strings/ctype-utf8.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 8fab93890f4..efd862f5a1c 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -4477,9 +4477,7 @@ int my_wildcmp_unicode_impl(CHARSET_INFO *cs,
int result= -1; /* Not found, using wildcards */
my_wc_t s_wc, w_wc;
int scan;
- int (*mb_wc)(CHARSET_INFO *, my_wc_t *,
- const uchar *, const uchar *);
- mb_wc= cs->cset->mb_wc;
+ my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc;
if (my_string_stack_guard && my_string_stack_guard(recurse_level))
return 1;
@@ -4507,12 +4505,12 @@ int my_wildcmp_unicode_impl(CHARSET_INFO *cs,
wildstr+= scan;
escaped= 1;
}
-
+
if ((scan= mb_wc(cs, &s_wc, (const uchar*)str,
(const uchar*)str_end)) <= 0)
return 1;
str+= scan;
-
+
if (!escaped && w_wc == (my_wc_t) w_one)
{
result= 1; /* Found an anchor char */
@@ -4530,86 +4528,84 @@ int my_wildcmp_unicode_impl(CHARSET_INFO *cs,
if (wildstr == wildend)
return (str != str_end); /* Match if both are at end */
}
-
-
+
if (w_wc == (my_wc_t) w_many)
{ /* Found w_many */
-
/* Remove any '%' and '_' from the wild search string */
for ( ; wildstr != wildend ; )
{
if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr,
(const uchar*)wildend)) <= 0)
return 1;
-
- if (w_wc == (my_wc_t)w_many)
+
+ if (w_wc == (my_wc_t) w_many)
{
wildstr+= scan;
continue;
}
-
- if (w_wc == (my_wc_t)w_one)
+
+ if (w_wc == (my_wc_t) w_one)
{
wildstr+= scan;
if ((scan= mb_wc(cs, &s_wc, (const uchar*)str,
- (const uchar*)str_end)) <=0)
+ (const uchar*)str_end)) <= 0)
return 1;
str+= scan;
continue;
}
break; /* Not a wild character */
}
-
+
if (wildstr == wildend)
return 0; /* Ok if w_many is last */
-
+
if (str == str_end)
return -1;
-
+
if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr,
- (const uchar*)wildend)) <=0)
+ (const uchar*)wildend)) <= 0)
return 1;
wildstr+= scan;
-
- if (w_wc == (my_wc_t)escape)
+
+ if (w_wc == (my_wc_t) escape)
{
if (wildstr < wildend)
{
if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr,
- (const uchar*)wildend)) <=0)
+ (const uchar*)wildend)) <= 0)
return 1;
wildstr+= scan;
}
}
-
+
while (1)
{
/* Skip until the first character from wildstr is found */
while (str != str_end)
{
if ((scan= mb_wc(cs, &s_wc, (const uchar*)str,
- (const uchar*)str_end)) <=0)
+ (const uchar*)str_end)) <= 0)
return 1;
if (weights)
{
my_tosort_unicode(weights, &s_wc, cs->state);
my_tosort_unicode(weights, &w_wc, cs->state);
}
-
+
if (s_wc == w_wc)
break;
str+= scan;
}
if (str == str_end)
return -1;
-
+
str+= scan;
result= my_wildcmp_unicode_impl(cs, str, str_end, wildstr, wildend,
escape, w_one, w_many,
weights, recurse_level + 1);
if (result <= 0)
return result;
- }
+ }
}
}
return (str != str_end ? 1 : 0);