summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-02-20 18:51:43 +0200
committerMichael Widenius <monty@askmonty.org>2011-02-20 18:51:43 +0200
commit58bb0769bdf13a9747e900aa2f0955137738ce9d (patch)
tree1b46ea0f72dce27532f0c87c60ba8a1baa453fa0 /strings
parent7e497abcfb3e761ba5a368316192ae930fb58f6b (diff)
parentde3c4428b8c759e85631d8d70b5845c872de5400 (diff)
downloadmariadb-git-58bb0769bdf13a9747e900aa2f0955137738ce9d.tar.gz
Merge with MySQL 5.1.55
- Fixed some issues with partitions and connection_string, which also fixed lp:716890 "Pre- and post-recovery crash in Aria" - Fixed wrong assert in Aria Now need to merge with latest xtradb before pushing sql/ha_partition.cc: Ensure that m_ordered_rec_buffer is not freed before close. sql/mysqld.cc: Changed to use opt_stack_trace instead of opt_pstack. Removed references to pstack sql/partition_element.h: Ensure that connect_string is initialized storage/maria/ma_key_recover.c: Fixed wrong assert
Diffstat (limited to 'strings')
-rw-r--r--strings/CHARSET_INFO.txt11
-rw-r--r--strings/ctype-extra.c10
-rw-r--r--strings/my_strchr.c65
3 files changed, 70 insertions, 16 deletions
diff --git a/strings/CHARSET_INFO.txt b/strings/CHARSET_INFO.txt
index bb8e40025c7..6f0a810be37 100644
--- a/strings/CHARSET_INFO.txt
+++ b/strings/CHARSET_INFO.txt
@@ -208,14 +208,11 @@ charpos() - calculates the offset of the given position in the string.
Used in SQL functions LEFT(), RIGHT(), SUBSTRING(),
INSERT()
-well_formed_length()
- - finds the length of correctly formed multi-byte beginning.
- Used in INSERTs to cut a beginning of the given string
- which is
- a) "well formed" according to the given character set.
+well_formed_len()
+ - returns length of a given multi-byte string in bytes
+ Used in INSERTs to shorten the given string so it
+ a) is "well formed" according to the given character set
b) can fit into the given data type
- Terminates the string in the good position, taking in account
- multi-byte character boundaries.
lengthsp() - returns the length of the given string without trailing spaces.
diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c
index bf9e31bfa18..f57186fc4be 100644
--- a/strings/ctype-extra.c
+++ b/strings/ctype-extra.c
@@ -1040,7 +1040,7 @@ uint16 to_uni_cp1251_bulgarian_ci[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
-0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
+0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
@@ -1730,7 +1730,7 @@ uint16 to_uni_cp1251_ukrainian_ci[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
-0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
+0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
@@ -3762,7 +3762,7 @@ uint16 to_uni_cp1251_bin[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
-0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
+0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
@@ -3877,7 +3877,7 @@ uint16 to_uni_cp1251_general_ci[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
-0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
+0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
@@ -3992,7 +3992,7 @@ uint16 to_uni_cp1251_general_cs[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
-0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
+0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
diff --git a/strings/my_strchr.c b/strings/my_strchr.c
index 8c471b1ab3a..5f1d985ba1a 100644
--- a/strings/my_strchr.c
+++ b/strings/my_strchr.c
@@ -13,6 +13,44 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include "strings_def.h"
+#include <m_ctype.h>
+
+#define NEQ(A, B) ((A) != (B))
+#define EQU(A, B) ((A) == (B))
+
+/**
+ Macro for the body of the string scanning.
+
+ @param CS The character set of the string
+ @param STR Pointer to beginning of string
+ @param END Pointer to one-after-end of string
+ @param ACC Pointer to beginning of accept (or reject) string
+ @param LEN Length of accept (or reject) string
+ @param CMP is a function-like for doing the comparison of two characters.
+ */
+
+#define SCAN_STRING(CS, STR, END, ACC, LEN, CMP) \
+ do { \
+ uint mbl; \
+ const char *ptr_str, *ptr_acc; \
+ const char *acc_end= (ACC) + (LEN); \
+ for (ptr_str= (STR) ; ptr_str < (END) ; ptr_str+= mbl) \
+ { \
+ mbl= my_mbcharlen((CS), *(uchar*)ptr_str); \
+ if (mbl < 2) \
+ { \
+ DBUG_ASSERT(mbl == 1); \
+ for (ptr_acc= (ACC) ; ptr_acc < acc_end ; ++ptr_acc) \
+ if (CMP(*ptr_acc, *ptr_str)) \
+ goto end; \
+ } \
+ } \
+end: \
+ return (size_t) (ptr_str - (STR)); \
+ } while (0)
+
+
/*
my_strchr(cs, str, end, c) returns a pointer to the first place in
str where c (1-byte character) occurs, or NULL if c does not occur
@@ -21,10 +59,6 @@
frequently.
*/
-#include "strings_def.h"
-#include <m_ctype.h>
-
-
char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end,
pchar c)
{
@@ -44,3 +78,26 @@ char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end,
return(0);
}
+/**
+ Calculate the length of the initial segment of 'str' which consists
+ entirely of characters not in 'reject'.
+
+ @note The reject string points to single-byte characters so it is
+ only possible to find the first occurrence of a single-byte
+ character. Multi-byte characters in 'str' are treated as not
+ matching any character in the reject string.
+
+ @todo should be moved to CHARSET_INFO if it's going to be called
+ frequently.
+
+ @internal The implementation builds on the assumption that 'str' is long,
+ while 'reject' is short. So it compares each character in string
+ with the characters in 'reject' in a tight loop over the characters
+ in 'reject'.
+*/
+
+size_t my_strcspn(CHARSET_INFO *cs, const char *str, const char *str_end,
+ const char *reject)
+{
+ SCAN_STRING(cs, str, str_end, reject, strlen(reject), EQU);
+}