summaryrefslogtreecommitdiff
path: root/strings/ctype-mb.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-05-07 13:05:09 +0200
committerSergei Golubchik <sergii@pisem.net>2013-05-07 13:05:09 +0200
commitb381cf843c841151f96541b19bd753cd3bbae326 (patch)
treedfc377a1dfbd4d2044a0b799ff5ed6411c7e864f /strings/ctype-mb.c
parentd4be9e7bc0cfd5ddd444ecc64daa4166597ca2eb (diff)
parente5055e22f1f311fa48457cfcc97b72e93a37329f (diff)
downloadmariadb-git-b381cf843c841151f96541b19bd753cd3bbae326.tar.gz
mysql-5.5.31 merge
Diffstat (limited to 'strings/ctype-mb.c')
-rw-r--r--strings/ctype-mb.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 5879bdf7978..0c0332ea3da 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -251,13 +251,16 @@ int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)
#define likeconv(s,A) (uchar) (s)->sort_order[(uchar) (A)]
-int my_wildcmp_mb(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many)
+static
+int my_wildcmp_mb_impl(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (*wildstr != w_many && *wildstr != w_one)
@@ -346,8 +349,8 @@ int my_wildcmp_mb(CHARSET_INFO *cs,
INC_PTR(cs,str, str_end);
}
{
- int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,
- w_many);
+ int tmp=my_wildcmp_mb_impl(cs,str,str_end,wildstr,wildend,escape,w_one,
+ w_many, recurse_level + 1);
if (tmp <= 0)
return (tmp);
}
@@ -358,6 +361,16 @@ int my_wildcmp_mb(CHARSET_INFO *cs,
return (str != str_end ? 1 : 0);
}
+int my_wildcmp_mb(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ return my_wildcmp_mb_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
size_t my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)),
const char *pos, const char *end)
@@ -987,14 +1000,15 @@ pad_min_max:
}
-int
-my_wildcmp_mb_bin(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many)
+static int my_wildcmp_mb_bin_impl(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (*wildstr != w_many && *wildstr != w_one)
@@ -1081,7 +1095,9 @@ my_wildcmp_mb_bin(CHARSET_INFO *cs,
INC_PTR(cs,str, str_end);
}
{
- int tmp=my_wildcmp_mb_bin(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
+ int tmp=my_wildcmp_mb_bin_impl(cs,str,str_end,
+ wildstr,wildend,escape,
+ w_one,w_many, recurse_level+1);
if (tmp <= 0)
return (tmp);
}
@@ -1092,6 +1108,17 @@ my_wildcmp_mb_bin(CHARSET_INFO *cs,
return (str != str_end ? 1 : 0);
}
+int
+my_wildcmp_mb_bin(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ return my_wildcmp_mb_bin_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
/*
Data was produced from EastAsianWidth.txt