diff --git a/strings/ctype-uca-scanner_next.inl b/strings/ctype-uca-scanner_next.inl index b79e0deff1a..e8489ddf191 100644 --- a/strings/ctype-uca-scanner_next.inl +++ b/strings/ctype-uca-scanner_next.inl @@ -43,10 +43,12 @@ static inline #ifdef SCANNER_NEXT_NCHARS weight_and_nchars_t MY_FUNCTION_NAME(scanner_next_with_nchars)(my_uca_scanner *scanner, + const my_uca_scanner_param *param, size_t nchars) #else int -MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner) +MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner, + const my_uca_scanner_param *param) #endif { #ifdef SCANNER_NEXT_NCHARS @@ -82,7 +84,7 @@ MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner) if (scanner->sbeg + 1 < scanner->send) { const MY_UCA_2BYTES_ITEM *ww; - ww= my_uca_level_booster_2bytes_item_addr_const(scanner->level->booster, + ww= my_uca_level_booster_2bytes_item_addr_const(param->level->booster, scanner->sbeg[0], scanner->sbeg[1]); if (my_uca_2bytes_item_is_applicable(ww)) @@ -126,9 +128,10 @@ MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner) scanner->sbeg+= 1; #if MY_UCA_COMPILE_CONTRACTIONS - if (my_uca_needs_context_handling(scanner->level, currwc)) + if (my_uca_needs_context_handling(param->level, currwc)) { - const MY_CONTRACTION *cnt= my_uca_context_weight_find(scanner, currwc, + const MY_CONTRACTION *cnt= my_uca_context_weight_find(scanner, param, + currwc, LOCAL_MAX_CONTRACTION_LENGTH); if (cnt) { @@ -141,7 +144,7 @@ MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner) scanner->page= 0; scanner->code= (int) currwc; - cweight= scanner->level->weights[0] + scanner->code * scanner->level->lengths[0]; + cweight= param->level->weights[0] + scanner->code * param->level->lengths[0]; if ((weight= my_uca_scanner_set_weight(scanner, cweight))) SCANNER_NEXT_RETURN(weight, ignorable_nchars + 1); continue; /* Ignorable character */ @@ -149,7 +152,7 @@ MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner) else #endif /* Get next MB character */ - if (((mblen= MY_MB_WC(scanner, &currwc, scanner->sbeg, + if (((mblen= MY_MB_WC(scanner, param, &currwc, scanner->sbeg, scanner->send)) <= 0)) { if (scanner->sbeg >= scanner->send) @@ -161,7 +164,7 @@ MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner) There are some more bytes left. Non-positive mb_len means that we got an incomplete or a bad byte sequence. Consume mbminlen bytes. */ - if ((scanner->sbeg+= scanner->cs->mbminlen) > scanner->send) + if ((scanner->sbeg+= param->cs->mbminlen) > scanner->send) { /* For safety purposes don't go beyond the string range. */ scanner->sbeg= scanner->send; @@ -175,16 +178,16 @@ MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner) } scanner->sbeg+= mblen; - if (currwc > scanner->level->maxchar) + if (currwc > param->level->maxchar) { SCANNER_NEXT_RETURN(my_uca_scanner_set_weight_outside_maxchar(scanner), ignorable_nchars + 1); } #if MY_UCA_COMPILE_CONTRACTIONS - if (my_uca_needs_context_handling(scanner->level, currwc)) + if (my_uca_needs_context_handling(param->level, currwc)) { - const MY_CONTRACTION *cnt= my_uca_context_weight_find(scanner, currwc, + const MY_CONTRACTION *cnt= my_uca_context_weight_find(scanner, param, currwc, LOCAL_MAX_CONTRACTION_LENGTH); if (cnt) { @@ -200,12 +203,12 @@ MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner) scanner->code= currwc & 0xFF; /* If weight page for w[0] does not exist, then calculate algoritmically */ - if (!(wpage= scanner->level->weights[scanner->page])) - SCANNER_NEXT_RETURN(my_uca_scanner_next_implicit(scanner), + if (!(wpage= param->level->weights[scanner->page])) + SCANNER_NEXT_RETURN(my_uca_scanner_next_implicit(scanner, param), ignorable_nchars + 1); /* Calculate pointer to w[0]'s weight, using page and offset */ - cweight= wpage + scanner->code * scanner->level->lengths[scanner->page]; + cweight= wpage + scanner->code * param->level->lengths[scanner->page]; if ((weight= my_uca_scanner_set_weight(scanner, cweight))) SCANNER_NEXT_RETURN(weight, ignorable_nchars + 1); continue; /* Ignorable character */ diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 028d2cccd78..5cedd8b0a63 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -31312,6 +31312,13 @@ my_uca1400_info_tailored[MY_CS_ENCODING_LAST+1] [MY_UCA1400_COLLATION_DEFINITION_COUNT]; +typedef struct my_uca_scanner_param_st +{ + const MY_UCA_WEIGHT_LEVEL *level; + CHARSET_INFO *cs; +} my_uca_scanner_param; + + /* Unicode Collation Algorithm: Collation element (weight) scanner, @@ -31323,11 +31330,9 @@ typedef struct my_uca_scanner_st const uint16 *wbeg; /* Beginning of the current weight string */ const uchar *sbeg; /* Beginning of the input string */ const uchar *send; /* End of the input string */ - const MY_UCA_WEIGHT_LEVEL *level; uint16 implicit[2]; int page; int code; - CHARSET_INFO *cs; } my_uca_scanner; @@ -31870,6 +31875,7 @@ my_uca_contraction_find(const MY_CONTRACTIONS *list, my_wc_t *wc, size_t len) static const MY_CONTRACTION * my_uca_scanner_contraction_hash_find(my_uca_scanner *scanner, + const my_uca_scanner_param *param, my_wc_t currwc, size_t max_char_length) { @@ -31887,10 +31893,10 @@ my_uca_scanner_contraction_hash_find(my_uca_scanner *scanner, flag<<= 1) { int mblen; - if ((mblen= my_ci_mb_wc(scanner->cs, &wc[clen], s, scanner->send)) <= 0) + if ((mblen= my_ci_mb_wc(param->cs, &wc[clen], s, scanner->send)) <= 0) break; beg[clen]= s= s + mblen; - if (!my_uca_can_be_contraction_part(&scanner->level->contractions, + if (!my_uca_can_be_contraction_part(¶m->level->contractions, wc[clen++], flag)) break; } @@ -31899,9 +31905,9 @@ my_uca_scanner_contraction_hash_find(my_uca_scanner *scanner, for ( ; clen > 1; clen--) { const MY_CONTRACTION *cnt; - if (my_uca_can_be_contraction_tail(&scanner->level->contractions, + if (my_uca_can_be_contraction_tail(¶m->level->contractions, wc[clen - 1]) && - (cnt= my_uca_contraction_hash_find(&scanner->level->contraction_hash, + (cnt= my_uca_contraction_hash_find(¶m->level->contraction_hash, wc, clen))) { scanner->sbeg= beg[clen - 1]; @@ -31959,12 +31965,14 @@ my_uca_previous_context_find(const MY_CONTRACTIONS *list, @retval non null pointer - the address of MY_CONTRACTION found */ static inline const MY_CONTRACTION * -my_uca_context_weight_find(my_uca_scanner *scanner, my_wc_t currwc, +my_uca_context_weight_find(my_uca_scanner *scanner, + const my_uca_scanner_param *param, + my_wc_t currwc, size_t max_char_length) { const MY_CONTRACTION *cnt; my_wc_t prevwc; - DBUG_ASSERT(scanner->level->contractions.nitems); + DBUG_ASSERT(param->level->contractions.nitems); /* If we have scanned a character which can have previous context, and there were some more characters already before, @@ -31974,23 +31982,23 @@ my_uca_context_weight_find(my_uca_scanner *scanner, my_wc_t currwc, Note, we support only 2-character long sequences with previous context at the moment. CLDR does not have longer sequences. */ - if (my_uca_can_be_previous_context_tail(&scanner->level->contractions, + if (my_uca_can_be_previous_context_tail(¶m->level->contractions, currwc) && scanner->wbeg != nochar && /* if not the very first character */ - my_uca_can_be_previous_context_head(&scanner->level->contractions, + my_uca_can_be_previous_context_head(¶m->level->contractions, (prevwc= ((scanner->page << 8) + scanner->code))) && - (cnt= my_uca_previous_context_find(&scanner->level->contractions, + (cnt= my_uca_previous_context_find(¶m->level->contractions, prevwc, currwc))) { scanner->page= scanner->code= 0; /* Clear for the next character */ return cnt; } - else if (my_uca_can_be_contraction_head(&scanner->level->contractions, + else if (my_uca_can_be_contraction_head(¶m->level->contractions, currwc)) { /* Check if w[0] starts a contraction */ - if ((cnt= my_uca_scanner_contraction_hash_find(scanner, currwc, + if ((cnt= my_uca_scanner_contraction_hash_find(scanner, param, currwc, max_char_length))) return cnt; } @@ -32026,10 +32034,11 @@ my_uca_implicit_weight_put(uint16 *to, const MY_UCA_INFO *src_uca, */ static inline int -my_uca_scanner_next_implicit_primary(my_uca_scanner *scanner) +my_uca_scanner_next_implicit_primary(my_uca_scanner *scanner, + const my_uca_scanner_param *param) { my_wc_t wc= (scanner->page << 8) + scanner->code; - uint version= scanner->cs->uca->version; + uint version= param->cs->uca->version; MY_UCA_IMPLICIT_WEIGHT weight= my_uca_implicit_weight_primary(version, wc); scanner->implicit[0]= weight.weight[1]; /* The second weight */ scanner->implicit[1]= 0; /* 0 terminator */ @@ -32040,14 +32049,15 @@ my_uca_scanner_next_implicit_primary(my_uca_scanner *scanner) /** Return an implicit weight for the current level - (according to scanner->level->levelno). + (according to param->level->levelno). */ static inline int -my_uca_scanner_next_implicit(my_uca_scanner *scanner) +my_uca_scanner_next_implicit(my_uca_scanner *scanner, + const my_uca_scanner_param *param) { - switch (scanner->level->levelno) { - case 0: return my_uca_scanner_next_implicit_primary(scanner);/* Primary level*/ + switch (param->level->levelno) { + case 0: return my_uca_scanner_next_implicit_primary(scanner, param);/* Primary level*/ case 1: scanner->wbeg= nochar; return 0x0020; /* Secondary level */ case 2: scanner->wbeg= nochar; return 0x0002; /* Tertiary level */ default: scanner->wbeg= nochar; break; @@ -32056,21 +32066,28 @@ my_uca_scanner_next_implicit(my_uca_scanner *scanner) return 0; } + +static void +my_uca_scanner_param_init(my_uca_scanner_param *param, + CHARSET_INFO *cs, + const MY_UCA_WEIGHT_LEVEL *level) +{ + param->cs= cs; + param->level= level; +} + + /* The same two functions for any character set */ static void my_uca_scanner_init_any(my_uca_scanner *scanner, - CHARSET_INFO *cs, - const MY_UCA_WEIGHT_LEVEL *level, const uchar *str, size_t length) { /* Note, no needs to initialize scanner->wbeg */ scanner->sbeg= str; scanner->send= str + length; scanner->wbeg= nochar; - scanner->level= level; - scanner->cs= cs; } @@ -34648,7 +34665,7 @@ static void my_uca_handler_map(struct charset_info_st *cs, instead of generic. */ #define MY_FUNCTION_NAME(x) my_uca_ ## x ## _generic -#define MY_MB_WC(scanner, wc, beg, end) (my_ci_mb_wc(scanner->cs, wc, beg, end)) +#define MY_MB_WC(scanner, param, wc, beg, end) (my_ci_mb_wc(param->cs, wc, beg, end)) #define MY_LIKE_RANGE my_like_range_generic #define MY_UCA_ASCII_OPTIMIZE 0 #define MY_UCA_COMPILE_CONTRACTIONS 1 @@ -34813,7 +34830,7 @@ ex: #include "ctype-ucs2.h" #define MY_FUNCTION_NAME(x) my_uca_ ## x ## _ucs2 -#define MY_MB_WC(scanner, wc, beg, end) (my_mb_wc_ucs2_quick(wc, beg, end)) +#define MY_MB_WC(scanner, param, wc, beg, end) (my_mb_wc_ucs2_quick(wc, beg, end)) #define MY_LIKE_RANGE my_like_range_generic #define MY_UCA_ASCII_OPTIMIZE 0 #define MY_UCA_COMPILE_CONTRACTIONS 1 @@ -35775,7 +35792,7 @@ my_uca_coll_init_utf8mb3(struct charset_info_st *cs, MY_CHARSET_LOADER *loader); #include "ctype-utf8.h" #define MY_FUNCTION_NAME(x) my_uca_ ## x ## _utf8mb3 -#define MY_MB_WC(scanner, wc, beg, end) (my_mb_wc_utf8mb3_quick(wc, beg, end)) +#define MY_MB_WC(scanner, param, wc, beg, end) (my_mb_wc_utf8mb3_quick(wc, beg, end)) #define MY_LIKE_RANGE my_like_range_mb #define MY_UCA_ASCII_OPTIMIZE 1 #define MY_UCA_COMPILE_CONTRACTIONS 1 @@ -35783,7 +35800,7 @@ my_uca_coll_init_utf8mb3(struct charset_info_st *cs, MY_CHARSET_LOADER *loader); #include "ctype-uca.inl" #define MY_FUNCTION_NAME(x) my_uca_ ## x ## _no_contractions_utf8mb3 -#define MY_MB_WC(scanner, wc, beg, end) (my_mb_wc_utf8mb3_quick(wc, beg, end)) +#define MY_MB_WC(scanner, param, wc, beg, end) (my_mb_wc_utf8mb3_quick(wc, beg, end)) #define MY_LIKE_RANGE my_like_range_mb #define MY_UCA_ASCII_OPTIMIZE 1 #define MY_UCA_COMPILE_CONTRACTIONS 0 @@ -36780,7 +36797,7 @@ my_uca_coll_init_utf8mb4(struct charset_info_st *cs, MY_CHARSET_LOADER *loader); #define MY_FUNCTION_NAME(x) my_uca_ ## x ## _utf8mb4 -#define MY_MB_WC(scanner, wc, beg, end) (my_mb_wc_utf8mb4_quick(wc, beg, end)) +#define MY_MB_WC(scanner, param, wc, beg, end) (my_mb_wc_utf8mb4_quick(wc, beg, end)) #define MY_LIKE_RANGE my_like_range_mb #define MY_UCA_ASCII_OPTIMIZE 1 #define MY_UCA_COMPILE_CONTRACTIONS 1 @@ -36788,7 +36805,7 @@ my_uca_coll_init_utf8mb4(struct charset_info_st *cs, MY_CHARSET_LOADER *loader); #include "ctype-uca.inl" #define MY_FUNCTION_NAME(x) my_uca_ ## x ## _no_contractions_utf8mb4 -#define MY_MB_WC(scanner, wc, beg, end) (my_mb_wc_utf8mb4_quick(wc, beg, end)) +#define MY_MB_WC(scanner, param, wc, beg, end) (my_mb_wc_utf8mb4_quick(wc, beg, end)) #define MY_LIKE_RANGE my_like_range_mb #define MY_UCA_ASCII_OPTIMIZE 1 #define MY_UCA_COMPILE_CONTRACTIONS 0 @@ -37756,7 +37773,7 @@ struct charset_info_st my_charset_utf8mb4_unicode_520_nopad_ci= #include "ctype-utf32.h" #define MY_FUNCTION_NAME(x) my_uca_ ## x ## _utf32 -#define MY_MB_WC(scanner, wc, beg, end) (my_mb_wc_utf32_quick(wc, beg, end)) +#define MY_MB_WC(scanner, param, wc, beg, end) (my_mb_wc_utf32_quick(wc, beg, end)) #define MY_LIKE_RANGE my_like_range_generic #define MY_UCA_ASCII_OPTIMIZE 0 #define MY_UCA_COMPILE_CONTRACTIONS 1 @@ -38713,7 +38730,7 @@ struct charset_info_st my_charset_utf32_unicode_520_nopad_ci= #include "ctype-utf16.h" #define MY_FUNCTION_NAME(x) my_uca_ ## x ## _utf16 -#define MY_MB_WC(scanner, wc, beg, end) (my_mb_wc_utf16_quick(wc, beg, end)) +#define MY_MB_WC(scanner, param, wc, beg, end) (my_mb_wc_utf16_quick(wc, beg, end)) #define MY_LIKE_RANGE my_like_range_generic #define MY_UCA_ASCII_OPTIMIZE 0 #define MY_UCA_COMPILE_CONTRACTIONS 1 diff --git a/strings/ctype-uca.inl b/strings/ctype-uca.inl index f3d543be1b1..9b8c271ab50 100644 --- a/strings/ctype-uca.inl +++ b/strings/ctype-uca.inl @@ -93,6 +93,7 @@ MY_FUNCTION_NAME(strnncoll_onelevel)(CHARSET_INFO *cs, { my_uca_scanner sscanner; my_uca_scanner tscanner; + my_uca_scanner_param param; int s_res; int t_res; @@ -104,14 +105,15 @@ MY_FUNCTION_NAME(strnncoll_onelevel)(CHARSET_INFO *cs, t+= prefix, tlen-= prefix; } #endif - - my_uca_scanner_init_any(&sscanner, cs, level, s, slen); - my_uca_scanner_init_any(&tscanner, cs, level, t, tlen); + + my_uca_scanner_param_init(¶m, cs, level); + my_uca_scanner_init_any(&sscanner, s, slen); + my_uca_scanner_init_any(&tscanner, t, tlen); do { - s_res= MY_FUNCTION_NAME(scanner_next)(&sscanner); - t_res= MY_FUNCTION_NAME(scanner_next)(&tscanner); + s_res= MY_FUNCTION_NAME(scanner_next)(&sscanner, ¶m); + t_res= MY_FUNCTION_NAME(scanner_next)(&tscanner, ¶m); } while ( s_res == t_res && s_res >0); return (t_is_prefix && t_res < 0) ? 0 : (s_res - t_res); @@ -211,6 +213,7 @@ MY_FUNCTION_NAME(strnncollsp_onelevel)(CHARSET_INFO *cs, const uchar *t, size_t tlen) { my_uca_scanner sscanner, tscanner; + my_uca_scanner_param param; int s_res, t_res; #if MY_UCA_ASCII_OPTIMIZE @@ -222,13 +225,14 @@ MY_FUNCTION_NAME(strnncollsp_onelevel)(CHARSET_INFO *cs, } #endif - my_uca_scanner_init_any(&sscanner, cs, level, s, slen); - my_uca_scanner_init_any(&tscanner, cs, level, t, tlen); + my_uca_scanner_param_init(¶m, cs, level); + my_uca_scanner_init_any(&sscanner, s, slen); + my_uca_scanner_init_any(&tscanner, t, tlen); do { - s_res= MY_FUNCTION_NAME(scanner_next)(&sscanner); - t_res= MY_FUNCTION_NAME(scanner_next)(&tscanner); + s_res= MY_FUNCTION_NAME(scanner_next)(&sscanner, ¶m); + t_res= MY_FUNCTION_NAME(scanner_next)(&tscanner, ¶m); } while ( s_res == t_res && s_res >0); if (s_res > 0 && t_res < 0) @@ -241,7 +245,7 @@ MY_FUNCTION_NAME(strnncollsp_onelevel)(CHARSET_INFO *cs, { if (s_res != t_res) return (s_res - t_res); - s_res= MY_FUNCTION_NAME(scanner_next)(&sscanner); + s_res= MY_FUNCTION_NAME(scanner_next)(&sscanner, ¶m); } while (s_res > 0); return 0; } @@ -256,7 +260,7 @@ MY_FUNCTION_NAME(strnncollsp_onelevel)(CHARSET_INFO *cs, { if (s_res != t_res) return (s_res - t_res); - t_res= MY_FUNCTION_NAME(scanner_next)(&tscanner); + t_res= MY_FUNCTION_NAME(scanner_next)(&tscanner, ¶m); } while (t_res > 0); return 0; } @@ -392,6 +396,7 @@ MY_FUNCTION_NAME(strnncollsp_nopad_multilevel)(CHARSET_INFO *cs, */ static inline weight_and_nchars_t MY_FUNCTION_NAME(scanner_next_pad_trim)(my_uca_scanner *scanner, + my_uca_scanner_param *param, size_t nchars, uint *generated) { @@ -399,14 +404,14 @@ MY_FUNCTION_NAME(scanner_next_pad_trim)(my_uca_scanner *scanner, if (nchars > 0 || scanner->wbeg[0] /* Some weights from a previous expansion left */) { - if ((res= MY_FUNCTION_NAME(scanner_next_with_nchars)(scanner, + if ((res= MY_FUNCTION_NAME(scanner_next_with_nchars)(scanner, param, nchars)).weight < 0) { /* We reached the end of the string, but the caller wants more weights. Perform space padding. */ - res.weight= my_space_weight(scanner->level); + res.weight= my_space_weight(param->level); res.nchars= 1; (*generated)++; } @@ -420,8 +425,8 @@ MY_FUNCTION_NAME(scanner_next_pad_trim)(my_uca_scanner *scanner, e.g. CONCAT(x'00','a') with nchars=1. Perform trimming. */ - res.weight= scanner->cs->state & MY_CS_NOPAD ? - 0 : my_space_weight(scanner->level); + res.weight= param->cs->state & MY_CS_NOPAD ? + 0 : my_space_weight(param->level); res.nchars= (uint) nchars; (*generated)++; } @@ -429,8 +434,8 @@ MY_FUNCTION_NAME(scanner_next_pad_trim)(my_uca_scanner *scanner, else { /* The caller wants nchars==0. Perform trimming. */ - res.weight= scanner->cs->state & MY_CS_NOPAD ? - 0 : my_space_weight(scanner->level); + res.weight= param->cs->state & MY_CS_NOPAD ? + 0 : my_space_weight(param->level); res.nchars= 0; (*generated)++; } @@ -447,6 +452,7 @@ MY_FUNCTION_NAME(strnncollsp_nchars_onelevel)(CHARSET_INFO *cs, { my_uca_scanner sscanner; my_uca_scanner tscanner; + my_uca_scanner_param param; size_t s_nchars_left= nchars; size_t t_nchars_left= nchars; @@ -462,8 +468,9 @@ TODO: strnncollsp_nchars_onelevel #endif */ - my_uca_scanner_init_any(&sscanner, cs, level, s, slen); - my_uca_scanner_init_any(&tscanner, cs, level, t, tlen); + my_uca_scanner_param_init(¶m, cs, level); + my_uca_scanner_init_any(&sscanner, s, slen); + my_uca_scanner_init_any(&tscanner, t, tlen); for ( ; ; ) { @@ -472,9 +479,11 @@ TODO: strnncollsp_nchars_onelevel uint generated= 0; int diff; - s_res= MY_FUNCTION_NAME(scanner_next_pad_trim)(&sscanner, s_nchars_left, + s_res= MY_FUNCTION_NAME(scanner_next_pad_trim)(&sscanner, ¶m, + s_nchars_left, &generated); - t_res= MY_FUNCTION_NAME(scanner_next_pad_trim)(&tscanner, t_nchars_left, + t_res= MY_FUNCTION_NAME(scanner_next_pad_trim)(&tscanner, ¶m, + t_nchars_left, &generated); if ((diff= (s_res.weight - t_res.weight))) return diff; @@ -604,12 +613,14 @@ MY_FUNCTION_NAME(hash_sort)(CHARSET_INFO *cs, { int s_res; my_uca_scanner scanner; + my_uca_scanner_param param; int space_weight= my_space_weight(&cs->uca->level[0]); register ulong m1= *nr1, m2= *nr2; - my_uca_scanner_init_any(&scanner, cs, &cs->uca->level[0], s, slen); + my_uca_scanner_param_init(¶m, cs, &cs->uca->level[0]); + my_uca_scanner_init_any(&scanner, s, slen); - while ((s_res= MY_FUNCTION_NAME(scanner_next)(&scanner)) >0) + while ((s_res= MY_FUNCTION_NAME(scanner_next)(&scanner, ¶m)) >0) { if (s_res == space_weight) { @@ -618,7 +629,7 @@ MY_FUNCTION_NAME(hash_sort)(CHARSET_INFO *cs, do { count++; - if ((s_res= MY_FUNCTION_NAME(scanner_next)(&scanner)) <= 0) + if ((s_res= MY_FUNCTION_NAME(scanner_next)(&scanner, ¶m)) <= 0) { /* Skip strings at end of string */ goto end; @@ -658,11 +669,13 @@ MY_FUNCTION_NAME(hash_sort_nopad)(CHARSET_INFO *cs, { int s_res; my_uca_scanner scanner; + my_uca_scanner_param param; register ulong m1= *nr1, m2= *nr2; - my_uca_scanner_init_any(&scanner, cs, &cs->uca->level[0], s, slen); + my_uca_scanner_param_init(¶m, cs, &cs->uca->level[0]); + my_uca_scanner_init_any(&scanner, s, slen); - while ((s_res= MY_FUNCTION_NAME(scanner_next)(&scanner)) >0) + while ((s_res= MY_FUNCTION_NAME(scanner_next)(&scanner, ¶m)) >0) { /* See comment above why we can't use MY_HASH_ADD_16() */ MY_HASH_ADD(m1, m2, s_res >> 8); @@ -713,6 +726,7 @@ MY_FUNCTION_NAME(strnxfrm_onelevel_internal)(CHARSET_INFO *cs, const uchar *src, size_t srclen) { my_uca_scanner scanner; + my_uca_scanner_param param; int s_res; DBUG_ASSERT(src || !srclen); @@ -756,9 +770,12 @@ MY_FUNCTION_NAME(strnxfrm_onelevel_internal)(CHARSET_INFO *cs, } #endif - my_uca_scanner_init_any(&scanner, cs, level, src, srclen); + my_uca_scanner_param_init(¶m, cs, level); + my_uca_scanner_init_any(&scanner, src, srclen); + for (; dst < de && *nweights && - (s_res= MY_FUNCTION_NAME(scanner_next)(&scanner)) > 0 ; (*nweights)--) + (s_res= MY_FUNCTION_NAME(scanner_next)(&scanner, ¶m)) > 0 ; + (*nweights)--) { *dst++= s_res >> 8; if (dst < de)