diff options
author | Monty <monty@mariadb.org> | 2020-08-22 02:08:59 +0300 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-05-19 22:54:07 +0200 |
commit | a206658b985fe5e18fb5692fdb3698dad5aca70a (patch) | |
tree | eded15d92bd26154a7622a12f9ed6de6bd2fdf5c /unittest | |
parent | b0910dddf53e2b41d5257bb5bda81f885044048a (diff) | |
download | mariadb-git-a206658b985fe5e18fb5692fdb3698dad5aca70a.tar.gz |
Change CHARSET_INFO character set and collaction names to LEX_CSTRING
This change removed 68 explict strlen() calls from the code.
The following renames was done to ensure we don't use the old names
when merging code from earlier releases, as using the new variables
for print function could result in crashes:
- charset->csname renamed to charset->cs_name
- charset->name renamed to charset->coll_name
Almost everything where mechanical changes except:
- Changed to use the new Protocol::store(LEX_CSTRING..) when possible
- Changed to use field->store(LEX_CSTRING*, CHARSET_INFO*) when possible
- Changed to use String->append(LEX_CSTRING&) when possible
Other things:
- There where compiler issues with ensuring that all character set names
points to the same string: gcc doesn't allow one to use integer constants
when defining global structures (constant char * pointers works fine).
To get around this, I declared defines for each character set name
length.
Diffstat (limited to 'unittest')
-rw-r--r-- | unittest/mysys/ma_dyncol-t.c | 2 | ||||
-rw-r--r-- | unittest/strings/strings-t.c | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/unittest/mysys/ma_dyncol-t.c b/unittest/mysys/ma_dyncol-t.c index d76f1b49f8f..6e2c9b4c87a 100644 --- a/unittest/mysys/ma_dyncol-t.c +++ b/unittest/mysys/ma_dyncol-t.c @@ -236,7 +236,7 @@ void test_value_single_string(const char *string, size_t len, err: ok(rc, "'%s' - '%s' %u %u-%s", string, res.x.string.value.str, (uint)res.x.string.value.length, - (uint)res.x.string.charset->number, res.x.string.charset->name); + (uint)res.x.string.charset->number, res.x.string.charset->coll_name.str); /* cleanup */ val.x.string.value.str= NULL; // we did not allocated it mariadb_dyncol_free(&str); diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c index 768f0ba6b65..39e48a33627 100644 --- a/unittest/strings/strings-t.c +++ b/unittest/strings/strings-t.c @@ -31,7 +31,8 @@ test_like_range_for_charset(CHARSET_INFO *cs, const char *src, size_t src_len) my_ci_like_range(cs, src, src_len, '\\', '_', '%', sizeof(min_str), min_str, max_str, &min_len, &max_len); - diag("min_len=%d\tmax_len=%d\t%s", (int) min_len, (int) max_len, cs->name); + diag("min_len=%d\tmax_len=%d\t%s", (int) min_len, (int) max_len, + cs->coll_name.str); min_well_formed_len= my_well_formed_length(cs, min_str, min_str + min_len, 10000, &error); @@ -632,7 +633,7 @@ strcollsp(CHARSET_INFO *cs, const STRNNCOLL_PARAM *param) str2hex(ahex, sizeof(ahex), p->a, p->alen); str2hex(bhex, sizeof(bhex), p->b, p->blen); diag("%-20s %-10s %-10s %10d %10d%s", - cs->name, ahex, bhex, p->res, res, + cs->coll_name.str, ahex, bhex, p->res, res, eqres(res, p->res) ? "" : " FAILED"); if (!eqres(res, p->res)) { @@ -772,7 +773,7 @@ int main() if (test_like_range_for_charset(cs, "abc%", 4)) { ++failed; - diag("Failed for %s", cs->name); + diag("Failed for %s", cs->coll_name.str); } } ok(failed == 0, "Testing my_like_range_xxx() functions"); |