From a206658b985fe5e18fb5692fdb3698dad5aca70a Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 22 Aug 2020 02:08:59 +0300 Subject: 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. --- sql-common/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql-common') diff --git a/sql-common/client.c b/sql-common/client.c index 34e8f7f755e..a551258aa34 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -3219,7 +3219,7 @@ my_bool mysql_reconnect(MYSQL *mysql) strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate); DBUG_RETURN(1); } - if (mysql_set_character_set(&tmp_mysql, mysql->charset->csname)) + if (mysql_set_character_set(&tmp_mysql, mysql->charset->cs_name.str)) { DBUG_PRINT("error", ("mysql_set_character_set() failed")); bzero((char*) &tmp_mysql.options,sizeof(tmp_mysql.options)); -- cgit v1.2.1