summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-03-31 11:04:48 +0400
committerAlexander Barkov <bar@mariadb.org>2016-03-31 11:04:48 +0400
commit1d73005bf357a607423f858482c52ecb4712607d (patch)
tree974a3bbb7f8ee2ef7c0b15aa16aed03baa18926a /include
parent282497dd6d1049b4fb963641504c2733752845a7 (diff)
downloadmariadb-git-1d73005bf357a607423f858482c52ecb4712607d.tar.gz
MDEV-8360 Clean-up CHARSET_INFO: strnncollsp: diff_if_only_endspace_difference
- Removing the "diff_if_only_endspace_difference" argument from MY_COLLATION_HANDLER::strnncollsp(), my_strnncollsp_simple(), as well as in the function template MY_FUNCTION_NAME(strnncollsp) in strcoll.ic - Removing the "diff_if_only_space_different" from ha_compare_text(), hp_rec_key_cmp(). - Adding a new function my_strnncollsp_padspace_bin() and reusing it instead of duplicate code pieces in my_strnncollsp_8bit_bin(), my_strnncollsp_latin1_de(), my_strnncollsp_tis620(), my_strnncollsp_utf8_cs(). - Adding more tests for better coverage of the trailing space handling. - Removing the unused definition of HA_END_SPACE_ARE_EQUAL
Diffstat (limited to 'include')
-rw-r--r--include/m_ctype.h17
-rw-r--r--include/my_base.h6
-rw-r--r--include/my_compare.h2
3 files changed, 15 insertions, 10 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 615ee6ac1c6..d22a0b1f987 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -325,8 +325,7 @@ struct my_collation_handler_st
int (*strnncoll)(CHARSET_INFO *,
const uchar *, size_t, const uchar *, size_t, my_bool);
int (*strnncollsp)(CHARSET_INFO *,
- const uchar *, size_t, const uchar *, size_t,
- my_bool diff_if_only_endspace_difference);
+ const uchar *, size_t, const uchar *, size_t);
size_t (*strnxfrm)(CHARSET_INFO *,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags);
@@ -644,8 +643,7 @@ extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t, my_bool);
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
- const uchar *, size_t,
- my_bool diff_if_only_endspace_difference);
+ const uchar *, size_t);
extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, size_t len,
@@ -654,6 +652,17 @@ extern void my_hash_sort_bin(CHARSET_INFO *cs,
const uchar *key, size_t len, ulong *nr1,
ulong *nr2);
+/**
+ Compare a string to an array of spaces, for PAD SPACE comparison.
+ The function iterates through the string and compares every byte to 0x20.
+ @param - the string
+ @param - its length
+ @return <0 - if a byte less than 0x20 was found in the string.
+ @return 0 - if all bytes in the string were 0x20, or if length was 0.
+ @return >0 - if a byte greater than 0x20 was found in the string.
+*/
+extern int my_strnncollsp_padspace_bin(const uchar *str, size_t length);
+
extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length);
extern uint my_instr_simple(CHARSET_INFO *,
diff --git a/include/my_base.h b/include/my_base.h
index 8b546edac43..1317639c528 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -298,11 +298,7 @@ enum ha_base_keytype {
#define HA_SWAP_KEY 64
#define HA_REVERSE_SORT 128 /* Sort key in reverse order */
#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */
-/*
- End space in unique/varchar are considered equal. (Like 'a' and 'a ')
- Only needed for internal temporary tables.
-*/
-#define HA_END_SPACE_ARE_EQUAL 512
+
#define HA_BIT_PART 1024
#define HA_CAN_MEMCMP 2048 /* internal, never stored in frm */
diff --git a/include/my_compare.h b/include/my_compare.h
index 0db22b593f4..6b76483074b 100644
--- a/include/my_compare.h
+++ b/include/my_compare.h
@@ -108,7 +108,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
- const uchar *, uint , my_bool, my_bool);
+ const uchar *, uint , my_bool);
extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
const uchar *b, uint key_length, uint nextflag,
uint *diff_pos);