summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-06-06 17:51:28 +0200
committerSergei Golubchik <sergii@pisem.net>2013-06-06 17:51:28 +0200
commit4749d40c635634e25e07d28ce1a04e9263bcc375 (patch)
treec5bb3287675cd8676d76c8ee42ef2d79cc599e25 /strings
parent1ff1cb10fc236010b5969058cab934c2b306c931 (diff)
parent33ef993773449cb3917665b188f6b6575d399bd0 (diff)
downloadmariadb-git-4749d40c635634e25e07d28ce1a04e9263bcc375.tar.gz
5.5 merge
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-bin.c27
-rw-r--r--strings/ctype-mb.c51
-rw-r--r--strings/ctype-simple.c26
-rw-r--r--strings/ctype-uca.c24
-rw-r--r--strings/ctype-utf8.c30
-rw-r--r--strings/ctype.c2
-rw-r--r--strings/decimal.c2
7 files changed, 122 insertions, 40 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index d28d576c661..88a7f8b84e8 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -318,13 +318,16 @@ void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)),
#define INC_PTR(cs,A,B) (A)++
-int my_wildcmp_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_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)
@@ -383,8 +386,8 @@ int my_wildcmp_bin(CHARSET_INFO *cs,
if (str++ == str_end)
return(-1);
{
- int tmp=my_wildcmp_bin(cs,str,str_end,wildstr,wildend,escape,w_one,
- w_many);
+ int tmp=my_wildcmp_bin_impl(cs,str,str_end,wildstr,wildend,escape,w_one,
+ w_many, recurse_level + 1);
if (tmp <= 0)
return(tmp);
}
@@ -395,6 +398,16 @@ int my_wildcmp_bin(CHARSET_INFO *cs,
return(str != str_end ? 1 : 0);
}
+int my_wildcmp_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_bin_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
static size_t my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
uchar *dest, size_t dstlen,
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
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index e25c0783abf..3cd6805158e 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -847,13 +847,16 @@ cnv:
#define INC_PTR(cs,A,B) (A)++
-int my_wildcmp_8bit(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_8bit_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)
@@ -913,8 +916,9 @@ int my_wildcmp_8bit(CHARSET_INFO *cs,
str++;
if (str++ == str_end) return(-1);
{
- int tmp=my_wildcmp_8bit(cs,str,str_end,wildstr,wildend,escape,w_one,
- w_many);
+ int tmp=my_wildcmp_8bit_impl(cs,str,str_end,
+ wildstr,wildend,escape,w_one,
+ w_many, recurse_level+1);
if (tmp <= 0)
return(tmp);
}
@@ -925,6 +929,16 @@ int my_wildcmp_8bit(CHARSET_INFO *cs,
return(str != str_end ? 1 : 0);
}
+int my_wildcmp_8bit(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_8bit_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
/*
** Calculate min_str and max_str that ranges a LIKE string.
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index e4a8d7a4067..020cfdfcbbe 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -7487,16 +7487,18 @@ static int my_uca_charcmp(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
*/
static
-int my_wildcmp_uca(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 my_wildcmp_uca_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 */
my_wc_t s_wc, w_wc;
int scan;
my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc;
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (1)
@@ -7603,8 +7605,8 @@ int my_wildcmp_uca(CHARSET_INFO *cs,
if (str == str_end)
return -1;
- result= my_wildcmp_uca(cs, str, str_end, wildstr, wildend,
- escape, w_one, w_many);
+ result= my_wildcmp_uca_impl(cs, str, str_end, wildstr, wildend,
+ escape, w_one, w_many, recurse_level+1);
if (result <= 0)
return result;
@@ -7616,6 +7618,16 @@ int my_wildcmp_uca(CHARSET_INFO *cs,
return (str != str_end ? 1 : 0);
}
+int my_wildcmp_uca(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_uca_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
/*
Collation language is implemented according to
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index b96ca0e5bbe..b17840bd54c 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1920,11 +1920,12 @@ my_tosort_unicode(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
** 1 if matched with wildcard
*/
-int my_wildcmp_unicode(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many,
- MY_UNICASE_INFO *const *weights)
+static
+int my_wildcmp_unicode_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,
+ MY_UNICASE_INFO *const *weights, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
my_wc_t s_wc, w_wc;
@@ -1933,6 +1934,8 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
const uchar *, const uchar *);
mb_wc= cs->cset->mb_wc;
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (1)
@@ -2054,9 +2057,9 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
return -1;
str+= scan;
- result= my_wildcmp_unicode(cs, str, str_end, wildstr, wildend,
- escape, w_one, w_many,
- weights);
+ 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;
}
@@ -2066,6 +2069,17 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
}
+int
+my_wildcmp_unicode(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many,
+ MY_UNICASE_INFO *const *weights)
+{
+ return my_wildcmp_unicode_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, weights, 1);
+}
/*
Store sorting weights using 2 bytes per character.
diff --git a/strings/ctype.c b/strings/ctype.c
index 6b6983ada60..23f18b6617b 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -38,6 +38,8 @@
*/
+int (*my_string_stack_guard)(int)= NULL;
+
static char *mstr(char *str,const char *src,size_t l1,size_t l2)
{
l1= l1<l2 ? l1 : l2;
diff --git a/strings/decimal.c b/strings/decimal.c
index edff4c02885..4b07d8673a6 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2004, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab
This program is free software; you can redistribute it and/or modify