MDEV-21581 Helper functions and methods for CHARSET_INFO

This commit is contained in:
Alexander Barkov 2020-01-26 20:27:13 +04:00
commit f1e13fdc8d
118 changed files with 1416 additions and 1025 deletions

View file

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -91,7 +92,7 @@ fts_get_word(
while (doc < end) {
for (; doc < end;
doc += (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) {
mbl = cs->cset->ctype(cs, &ctype, doc, end);
mbl = cs->ctype(&ctype, doc, end);
if (true_word_char(ctype, *doc)) {
break;
@ -153,7 +154,7 @@ fts_get_word(
for (word->pos = doc;
doc < end;
length++, doc += (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) {
mbl = cs->cset->ctype(cs, &ctype, doc, end);
mbl = cs->ctype(&ctype, doc, end);
if (true_word_char(ctype, *doc)) {
mwc = 0;

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -185,12 +185,12 @@ fts_select_index_by_hash(
char_len = my_mbcharlen_ptr(cs, reinterpret_cast<const char*>(str),
reinterpret_cast<const char*>(str + len));
*/
size_t char_len = size_t(cs->cset->charlen(cs, str, str + len));
size_t char_len = size_t(cs->charlen(str, str + len));
ut_ad(char_len <= len);
/* Get collation hash code */
cs->coll->hash_sort(cs, str, char_len, &nr1, &nr2);
my_ci_hash_sort(cs, str, char_len, &nr1, &nr2);
return(nr1 % FTS_NUM_AUX_INDEX);
}

View file

@ -92,8 +92,7 @@ cmp_dfield_dfield_like_prefix(
uint cs_num = (uint) dtype_get_charset_coll(type->prtype);
if (CHARSET_INFO* cs = get_charset(cs_num, MYF(MY_WME))) {
return(cs->coll->strnncoll(
cs,
return(cs->strnncoll(
static_cast<const uchar*>(
dfield_get_data(dfield1)),
dfield_get_len(dfield1),