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 /strings/ctype-bin.c | |
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 'strings/ctype-bin.c')
-rw-r--r-- | strings/ctype-bin.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index c11be2e5926..2902c2edda1 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -24,6 +24,7 @@ #include <m_ctype.h> const char charset_name_binary[]= "binary"; +#define charset_name_binary_length (sizeof(charset_name_binary)-1) static const uchar ctype_bin[]= { @@ -570,8 +571,8 @@ struct charset_info_st my_charset_bin = { 63,0,0, /* number */ MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY|MY_CS_NOPAD,/* state */ - charset_name_binary, /* cs name */ - "binary", /* name */ + { charset_name_binary, charset_name_binary_length}, /* cs name */ + { STRING_WITH_LEN("binary")}, /* name */ "", /* comment */ NULL, /* tailoring */ ctype_bin, /* ctype */ |