Commit e8fb2466 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: use null_lex_str where appropriate

parent 6e05aabb
...@@ -582,8 +582,6 @@ sp_head::sp_head() ...@@ -582,8 +582,6 @@ sp_head::sp_head()
m_next_cached_sp(0), m_next_cached_sp(0),
m_cont_level(0) m_cont_level(0)
{ {
const LEX_STRING str_reset= { NULL, 0 };
m_first_instance= this; m_first_instance= this;
m_first_free_instance= this; m_first_free_instance= this;
m_last_cached_sp= this; m_last_cached_sp= this;
...@@ -594,7 +592,7 @@ sp_head::sp_head() ...@@ -594,7 +592,7 @@ sp_head::sp_head()
be rewritten soon. Remove the else part and replace 'if' with be rewritten soon. Remove the else part and replace 'if' with
an assert when this is done. an assert when this is done.
*/ */
m_db= m_name= m_qname= str_reset; m_db= m_name= m_qname= null_lex_str;
DBUG_ENTER("sp_head::sp_head"); DBUG_ENTER("sp_head::sp_head");
......
...@@ -515,8 +515,7 @@ void lex_start(THD *thd) ...@@ -515,8 +515,7 @@ void lex_start(THD *thd)
lex->check_exists= FALSE; lex->check_exists= FALSE;
lex->verbose= 0; lex->verbose= 0;
lex->name.str= 0; lex->name= null_lex_str;
lex->name.length= 0;
lex->event_parse_data= NULL; lex->event_parse_data= NULL;
lex->profile_options= PROFILE_NONE; lex->profile_options= PROFILE_NONE;
lex->nest_level=0 ; lex->nest_level=0 ;
......
...@@ -135,6 +135,9 @@ struct sys_var_with_base ...@@ -135,6 +135,9 @@ struct sys_var_with_base
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
extern const LEX_STRING null_lex_str;
extern const LEX_STRING empty_lex_str;
enum enum_sp_suid_behaviour enum enum_sp_suid_behaviour
{ {
SP_IS_DEFAULT_SUID= 0, SP_IS_DEFAULT_SUID= 0,
...@@ -242,8 +245,7 @@ struct LEX_MASTER_INFO ...@@ -242,8 +245,7 @@ struct LEX_MASTER_INFO
heartbeat_period= 0; heartbeat_period= 0;
ssl= ssl_verify_server_cert= heartbeat_opt= ssl= ssl_verify_server_cert= heartbeat_opt=
repl_ignore_server_ids_opt= LEX_MI_UNCHANGED; repl_ignore_server_ids_opt= LEX_MI_UNCHANGED;
gtid_pos_str.length= 0; gtid_pos_str= null_lex_str;
gtid_pos_str.str= NULL;
use_gtid_opt= LEX_GTID_UNCHANGED; use_gtid_opt= LEX_GTID_UNCHANGED;
} }
}; };
...@@ -1021,9 +1023,6 @@ struct st_sp_chistics ...@@ -1021,9 +1023,6 @@ struct st_sp_chistics
enum enum_sp_data_access daccess; enum enum_sp_data_access daccess;
}; };
extern const LEX_STRING null_lex_str;
extern const LEX_STRING empty_lex_str;
struct st_trg_chistics struct st_trg_chistics
{ {
enum trg_action_time_type action_time; enum trg_action_time_type action_time;
...@@ -1035,9 +1034,6 @@ extern sys_var *trg_new_row_fake_var; ...@@ -1035,9 +1034,6 @@ extern sys_var *trg_new_row_fake_var;
enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE, enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE,
XA_SUSPEND, XA_FOR_MIGRATE}; XA_SUSPEND, XA_FOR_MIGRATE};
extern const LEX_STRING null_lex_str;
extern const LEX_STRING empty_lex_str;
class Sroutine_hash_entry; class Sroutine_hash_entry;
/* /*
......
...@@ -1748,8 +1748,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1748,8 +1748,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
else else
#endif #endif
{ {
thd->lex->relay_log_connection_name.str= (char*) ""; thd->lex->relay_log_connection_name= empty_lex_str;
thd->lex->relay_log_connection_name.length= 0;
if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0, &not_used)) if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0, &not_used))
break; break;
} }
...@@ -6721,7 +6720,7 @@ void create_select_for_variable(const char *var_name) ...@@ -6721,7 +6720,7 @@ void create_select_for_variable(const char *var_name)
{ {
THD *thd; THD *thd;
LEX *lex; LEX *lex;
LEX_STRING tmp, null_lex_string; LEX_STRING tmp;
Item *var; Item *var;
char buff[MAX_SYS_VAR_LENGTH*2+4+8], *end; char buff[MAX_SYS_VAR_LENGTH*2+4+8], *end;
DBUG_ENTER("create_select_for_variable"); DBUG_ENTER("create_select_for_variable");
...@@ -6732,12 +6731,11 @@ void create_select_for_variable(const char *var_name) ...@@ -6732,12 +6731,11 @@ void create_select_for_variable(const char *var_name)
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
tmp.str= (char*) var_name; tmp.str= (char*) var_name;
tmp.length=strlen(var_name); tmp.length=strlen(var_name);
bzero((char*) &null_lex_string.str, sizeof(null_lex_string));
/* /*
We set the name of Item to @@session.var_name because that then is used We set the name of Item to @@session.var_name because that then is used
as the column name in the output. as the column name in the output.
*/ */
if ((var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string))) if ((var= get_system_var(thd, OPT_SESSION, tmp, null_lex_str)))
{ {
end= strxmov(buff, "@@session.", var_name, NullS); end= strxmov(buff, "@@session.", var_name, NullS);
var->set_name(buff, end-buff, system_charset_info); var->set_name(buff, end-buff, system_charset_info);
...@@ -8762,8 +8760,7 @@ LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name) ...@@ -8762,8 +8760,7 @@ LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name)
definer->user= *user_name; definer->user= *user_name;
definer->host= *host_name; definer->host= *host_name;
definer->password.str= NULL; definer->password= null_lex_str;
definer->password.length= 0;
return definer; return definer;
} }
......
...@@ -2374,8 +2374,7 @@ create: ...@@ -2374,8 +2374,7 @@ create:
lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB; lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB;
lex->create_info.options= ($1 | $2 | $4); lex->create_info.options= ($1 | $2 | $4);
lex->create_info.default_table_charset= NULL; lex->create_info.default_table_charset= NULL;
lex->name.str= 0; lex->name= null_lex_str;
lex->name.length= 0;
lex->create_last_non_select_table= lex->last_table(); lex->create_last_non_select_table= lex->last_table();
} }
create_body create_body
...@@ -7029,8 +7028,7 @@ string_list: ...@@ -7029,8 +7028,7 @@ string_list:
alter: alter:
ALTER ALTER
{ {
Lex->name.str= 0; Lex->name= null_lex_str;
Lex->name.length= 0;
Lex->sql_command= SQLCOM_ALTER_TABLE; Lex->sql_command= SQLCOM_ALTER_TABLE;
Lex->duplicates= DUP_ERROR; Lex->duplicates= DUP_ERROR;
Lex->col_list.empty(); Lex->col_list.empty();
...@@ -7247,7 +7245,7 @@ opt_ev_sql_stmt: ...@@ -7247,7 +7245,7 @@ opt_ev_sql_stmt:
; ;
ident_or_empty: ident_or_empty:
/* empty */ { $$.str= 0; $$.length= 0; } /* empty */ { $$= null_lex_str; }
| ident { $$= $1; } | ident { $$= $1; }
; ;
...@@ -12892,8 +12890,7 @@ flush_option: ...@@ -12892,8 +12890,7 @@ flush_option:
| LOGS_SYM | LOGS_SYM
{ {
Lex->type|= REFRESH_LOG; Lex->type|= REFRESH_LOG;
Lex->relay_log_connection_name.str= (char*) ""; Lex->relay_log_connection_name= empty_lex_str;
Lex->relay_log_connection_name.length= 0;
} }
| STATUS_SYM | STATUS_SYM
{ Lex->type|= REFRESH_STATUS; } { Lex->type|= REFRESH_STATUS; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment