From 1d73005bf357a607423f858482c52ecb4712607d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 31 Mar 2016 11:04:48 +0400 Subject: 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 --- storage/heap/hp_hash.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'storage/heap/hp_hash.c') diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c index b727c71d3de..eaf284c2015 100644 --- a/storage/heap/hp_hash.c +++ b/storage/heap/hp_hash.c @@ -513,8 +513,6 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec) keydef Key definition rec1 Record to compare rec2 Other record to compare - diff_if_only_endspace_difference - Different number of end space is significant NOTES diff_if_only_endspace_difference is used to allow us to insert @@ -525,8 +523,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec) <> 0 Key differes */ -int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2, - my_bool diff_if_only_endspace_difference) +int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2) { HA_KEYSEG *seg,*endseg; @@ -561,7 +558,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2, } if (seg->charset->coll->strnncollsp(seg->charset, pos1,char_length1, - pos2,char_length2, 0)) + pos2,char_length2)) return 1; } else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */ @@ -601,9 +598,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2, if (cs->coll->strnncollsp(seg->charset, pos1, char_length1, - pos2, char_length2, - seg->flag & HA_END_SPACE_ARE_EQUAL ? - 0 : diff_if_only_endspace_difference)) + pos2, char_length2)) return 1; } else @@ -671,7 +666,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key) if (seg->charset->coll->strnncollsp(seg->charset, (uchar*) pos, char_length_rec, - (uchar*) key, char_length_key, 0)) + (uchar*) key, char_length_key)) return 1; } else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */ @@ -699,7 +694,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key) if (cs->coll->strnncollsp(seg->charset, (uchar*) pos, char_length_rec, - (uchar*) key, char_length_key, 0)) + (uchar*) key, char_length_key)) return 1; } else -- cgit v1.2.1