Commit d508ef78 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: more 'const' qualifiers

parent 9ccaa62d
......@@ -103,7 +103,7 @@ LEX_STRING default_key_cache_base= {C_STRING_WITH_LEN("default")};
KEY_CACHE zero_key_cache; ///< @@nonexistent_cache.param->value_ptr() points here
KEY_CACHE *get_key_cache(LEX_STRING *cache_name)
KEY_CACHE *get_key_cache(const LEX_STRING *cache_name)
{
if (!cache_name || ! cache_name->length)
cache_name= &default_key_cache_base;
......
......@@ -40,7 +40,7 @@ extern KEY_CACHE zero_key_cache;
extern NAMED_ILIST key_caches;
KEY_CACHE *create_key_cache(const char *name, uint length);
KEY_CACHE *get_key_cache(LEX_STRING *cache_name);
KEY_CACHE *get_key_cache(const LEX_STRING *cache_name);
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
void free_key_cache(const char *name, KEY_CACHE *key_cache);
bool process_key_caches(process_key_cache_t func, void *param);
......
......@@ -1078,7 +1078,7 @@ bool Master_info_index::write_master_name_to_index_file(LEX_STRING *name,
*/
Master_info *
Master_info_index::get_master_info(LEX_STRING *connection_name,
Master_info_index::get_master_info(const LEX_STRING *connection_name,
Sql_condition::enum_warning_level warning)
{
Master_info *mi;
......
......@@ -209,7 +209,7 @@ public:
const char *host, uint port);
bool add_master_info(Master_info *mi, bool write_to_file);
bool remove_master_info(LEX_STRING *connection_name);
Master_info *get_master_info(LEX_STRING *connection_name,
Master_info *get_master_info(const LEX_STRING *connection_name,
Sql_condition::enum_warning_level warning);
bool give_error_if_slave_running();
bool start_all_slaves(THD *thd);
......
......@@ -200,12 +200,12 @@ bool sys_var::update(THD *thd, set_var *var)
(on_update && on_update(this, thd, OPT_SESSION));
}
uchar *sys_var::session_value_ptr(THD *thd, LEX_STRING *base)
uchar *sys_var::session_value_ptr(THD *thd, const LEX_STRING *base)
{
return session_var_ptr(thd);
}
uchar *sys_var::global_value_ptr(THD *thd, LEX_STRING *base)
uchar *sys_var::global_value_ptr(THD *thd, const LEX_STRING *base)
{
return global_var_ptr();
}
......@@ -238,7 +238,7 @@ bool sys_var::check(THD *thd, set_var *var)
return false;
}
uchar *sys_var::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
uchar *sys_var::value_ptr(THD *thd, enum_var_type type, const LEX_STRING *base)
{
if (type == OPT_GLOBAL || scope() == GLOBAL)
{
......
......@@ -107,7 +107,7 @@ public:
virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
bool check(THD *thd, set_var *var);
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
uchar *value_ptr(THD *thd, enum_var_type type, const LEX_STRING *base);
/**
Update the system variable with the default value from either
......@@ -208,8 +208,8 @@ protected:
It must be of show_val_type type (bool for SHOW_BOOL, int for SHOW_INT,
longlong for SHOW_LONGLONG, etc).
*/
virtual uchar *session_value_ptr(THD *thd, LEX_STRING *base);
virtual uchar *global_value_ptr(THD *thd, LEX_STRING *base);
virtual uchar *session_value_ptr(THD *thd, const LEX_STRING *base);
virtual uchar *global_value_ptr(THD *thd, const LEX_STRING *base);
/**
A pointer to a storage area of the variable, to the raw data.
......
......@@ -261,10 +261,10 @@ public:
sys_var_pluginvar *cast_pluginvar() { return this; }
uchar* real_value_ptr(THD *thd, enum_var_type type);
TYPELIB* plugin_var_typelib(void);
uchar* do_value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
uchar* session_value_ptr(THD *thd, LEX_STRING *base)
uchar* do_value_ptr(THD *thd, enum_var_type type, const LEX_STRING *base);
uchar* session_value_ptr(THD *thd, const LEX_STRING *base)
{ return do_value_ptr(thd, OPT_SESSION, base); }
uchar* global_value_ptr(THD *thd, LEX_STRING *base)
uchar* global_value_ptr(THD *thd, const LEX_STRING *base)
{ return do_value_ptr(thd, OPT_GLOBAL, base); }
bool do_check(THD *thd, set_var *var);
virtual void session_save_default(THD *thd, set_var *var) {}
......@@ -3270,7 +3270,7 @@ TYPELIB* sys_var_pluginvar::plugin_var_typelib(void)
uchar* sys_var_pluginvar::do_value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
const LEX_STRING *base)
{
uchar* result;
......
......@@ -1477,7 +1477,7 @@ static Sys_var_gtid_binlog_pos Sys_gtid_binlog_pos(
uchar *
Sys_var_gtid_binlog_pos::global_value_ptr(THD *thd, LEX_STRING *base)
Sys_var_gtid_binlog_pos::global_value_ptr(THD *thd, const LEX_STRING *base)
{
char buf[128];
String str(buf, sizeof(buf), system_charset_info);
......@@ -1505,7 +1505,7 @@ static Sys_var_gtid_current_pos Sys_gtid_current_pos(
uchar *
Sys_var_gtid_current_pos::global_value_ptr(THD *thd, LEX_STRING *base)
Sys_var_gtid_current_pos::global_value_ptr(THD *thd, const LEX_STRING *base)
{
String str;
char *p;
......@@ -1590,7 +1590,7 @@ Sys_var_gtid_slave_pos::global_update(THD *thd, set_var *var)
uchar *
Sys_var_gtid_slave_pos::global_value_ptr(THD *thd, LEX_STRING *base)
Sys_var_gtid_slave_pos::global_value_ptr(THD *thd, const LEX_STRING *base)
{
String str;
char *p;
......@@ -1708,7 +1708,7 @@ Sys_var_gtid_binlog_state::global_update(THD *thd, set_var *var)
uchar *
Sys_var_gtid_binlog_state::global_value_ptr(THD *thd, LEX_STRING *base)
Sys_var_gtid_binlog_state::global_value_ptr(THD *thd, const LEX_STRING *base)
{
char buf[512];
String str(buf, sizeof(buf), system_charset_info);
......@@ -1741,7 +1741,7 @@ static Sys_var_last_gtid Sys_last_gtid(
uchar *
Sys_var_last_gtid::session_value_ptr(THD *thd, LEX_STRING *base)
Sys_var_last_gtid::session_value_ptr(THD *thd, const LEX_STRING *base)
{
char buf[10+1+10+1+20+1];
String str(buf, sizeof(buf), system_charset_info);
......@@ -4123,7 +4123,7 @@ bool Sys_var_rpl_filter::set_filter_value(const char *value, Master_info *mi)
return status;
}
uchar *Sys_var_rpl_filter::global_value_ptr(THD *thd, LEX_STRING *base)
uchar *Sys_var_rpl_filter::global_value_ptr(THD *thd, const LEX_STRING *base)
{
char buf[256];
String tmp(buf, sizeof(buf), &my_charset_bin);
......
......@@ -333,9 +333,9 @@ public:
{ var->save_result.ulonglong_value= global_var(ulong); }
void global_save_default(THD *thd, set_var *var)
{ var->save_result.ulonglong_value= option.def_value; }
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{ return (uchar*)typelib.type_names[session_var(thd, ulong)]; }
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{ return (uchar*)typelib.type_names[global_var(ulong)]; }
};
......@@ -531,7 +531,7 @@ public:
void global_save_default(THD *thd, set_var *var)
{ DBUG_ASSERT(FALSE); }
protected:
virtual uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
return thd->security_ctx->proxy_user[0] ?
(uchar *) &(thd->security_ctx->proxy_user[0]) : NULL;
......@@ -547,7 +547,7 @@ public:
{}
protected:
virtual uchar *session_value_ptr(THD *thd, LEX_STRING *base)
virtual uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
return (uchar*)thd->security_ctx->external_user;
}
......@@ -587,7 +587,7 @@ public:
bool global_update(THD *thd, set_var *var);
protected:
uchar *global_value_ptr(THD *thd, LEX_STRING *base);
uchar *global_value_ptr(THD *thd, const LEX_STRING *base);
bool set_filter_value(const char *value, Master_info *mi);
};
......@@ -705,11 +705,11 @@ public:
{
DBUG_ASSERT(FALSE);
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
return (uchar*) &session_var(thd, LEX_STRING);
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(FALSE);
return NULL;
......@@ -778,13 +778,13 @@ public:
char *ptr= (char*)(intptr)option.def_value;
var->save_result.string_value.str= ptr;
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
char buf[256];
DBUG_EXPLAIN(buf, sizeof(buf));
return (uchar*) thd->strdup(buf);
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
char buf[256];
DBUG_EXPLAIN_INITIAL(buf, sizeof(buf));
......@@ -864,7 +864,7 @@ public:
return keycache_update(thd, key_cache, offset, new_value);
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
KEY_CACHE *key_cache= get_key_cache(base);
if (!key_cache)
......@@ -1049,7 +1049,7 @@ public:
lock, binlog_status_arg, on_check_func, on_update_func,
substitute)
{ }
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
if (thd->user_connect && thd->user_connect->user_resources.user_conn)
return (uchar*) &(thd->user_connect->user_resources.user_conn);
......@@ -1164,12 +1164,12 @@ public:
{ var->save_result.ulonglong_value= global_var(ulonglong); }
void global_save_default(THD *thd, set_var *var)
{ var->save_result.ulonglong_value= option.def_value; }
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
return (uchar*)flagset_to_string(thd, 0, session_var(thd, ulonglong),
typelib.type_names);
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
return (uchar*)flagset_to_string(thd, 0, global_var(ulonglong),
typelib.type_names);
......@@ -1265,12 +1265,12 @@ public:
{ var->save_result.ulonglong_value= global_var(ulonglong); }
void global_save_default(THD *thd, set_var *var)
{ var->save_result.ulonglong_value= option.def_value; }
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
return (uchar*)set_to_string(thd, 0, session_var(thd, ulonglong),
typelib.type_names);
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
return (uchar*)set_to_string(thd, 0, global_var(ulonglong),
typelib.type_names);
......@@ -1389,13 +1389,13 @@ public:
var->save_result.plugin= my_plugin_lock(thd, plugin);
}
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
plugin_ref plugin= session_var(thd, plugin_ref);
return (uchar*)(plugin ? thd->strmake(plugin_name(plugin)->str,
plugin_name(plugin)->length) : 0);
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
plugin_ref plugin= global_var(plugin_ref);
return (uchar*)(plugin ? thd->strmake(plugin_name(plugin)->str,
......@@ -1456,12 +1456,12 @@ public:
{
DBUG_ASSERT(FALSE);
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
extern uchar *debug_sync_value_ptr(THD *thd);
return debug_sync_value_ptr(thd);
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(FALSE);
return 0;
......@@ -1536,13 +1536,13 @@ public:
{ var->save_result.ulonglong_value= global_var(ulonglong) & bitmask; }
void global_save_default(THD *thd, set_var *var)
{ var->save_result.ulonglong_value= option.def_value; }
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
thd->sys_var_tmp.my_bool_value= reverse_semantics ^
((session_var(thd, ulonglong) & bitmask) != 0);
return (uchar*) &thd->sys_var_tmp.my_bool_value;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
thd->sys_var_tmp.my_bool_value= reverse_semantics ^
((global_var(ulonglong) & bitmask) != 0);
......@@ -1602,12 +1602,12 @@ public:
{ var->value= 0; }
void global_save_default(THD *thd, set_var *var)
{ DBUG_ASSERT(FALSE); }
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
thd->sys_var_tmp.ulonglong_value= read_func(thd);
return (uchar*) &thd->sys_var_tmp.ulonglong_value;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(FALSE);
return 0;
......@@ -1652,12 +1652,12 @@ public:
{ var->value= 0; }
void global_save_default(THD *thd, set_var *var)
{ DBUG_ASSERT(FALSE); }
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
thd->sys_var_tmp.double_value= read_func(thd);
return (uchar*) &thd->sys_var_tmp.double_value;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(FALSE);
return 0;
......@@ -1715,12 +1715,12 @@ public:
}
void session_save_default(THD *thd, set_var *var) { }
void global_save_default(THD *thd, set_var *var) { }
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(FALSE);
return 0;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
return (uchar*)show_comp_option_name[global_var(enum SHOW_COMP_OPTION)];
}
......@@ -1790,12 +1790,12 @@ public:
void **default_value= reinterpret_cast<void**>(option.def_value);
var->save_result.ptr= *default_value;
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
uchar *ptr= session_var(thd, uchar*);
return ptr ? *(uchar**)(ptr+name_offset) : 0;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
uchar *ptr= global_var(uchar*);
return ptr ? *(uchar**)(ptr+name_offset) : 0;
......@@ -1868,7 +1868,7 @@ public:
var->save_result.time_zone=
*(Time_zone**)(intptr)option.def_value;
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
/*
This is an ugly fix for replication: we don't replicate properly queries
......@@ -1881,7 +1881,7 @@ public:
thd->time_zone_used= 1;
return (uchar *)(session_var(thd, Time_zone*)->get_name()->ptr());
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
return (uchar *)(global_var(Time_zone*)->get_name()->ptr());
}
......@@ -2015,7 +2015,7 @@ public:
/* Use value given in variable declaration */
global_save_default(thd, var);
}
uchar *session_value_ptr(THD *thd,LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
uint *tmp, res;
tmp= (uint*) (((uchar*)&(thd->variables)) + offset);
......@@ -2023,7 +2023,7 @@ public:
*tmp= res;
return (uchar*) tmp;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
return session_value_ptr(thd, base);
}
......@@ -2073,12 +2073,12 @@ public:
{
DBUG_ASSERT(false);
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(false);
return NULL;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base);
uchar *global_value_ptr(THD *thd, const LEX_STRING *base);
};
......@@ -2120,12 +2120,12 @@ public:
{
DBUG_ASSERT(false);
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(false);
return NULL;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base);
uchar *global_value_ptr(THD *thd, const LEX_STRING *base);
};
......@@ -2160,12 +2160,12 @@ public:
/* Record the attempt to use default so we can error. */
var->value= 0;
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(false);
return NULL;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base);
uchar *global_value_ptr(THD *thd, const LEX_STRING *base);
};
......@@ -2200,12 +2200,12 @@ public:
/* Record the attempt to use default so we can error. */
var->value= 0;
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(false);
return NULL;
}
uchar *global_value_ptr(THD *thd, LEX_STRING *base);
uchar *global_value_ptr(THD *thd, const LEX_STRING *base);
};
......@@ -2246,8 +2246,8 @@ public:
{
DBUG_ASSERT(false);
}
uchar *session_value_ptr(THD *thd, LEX_STRING *base);
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
uchar *session_value_ptr(THD *thd, const LEX_STRING *base);
uchar *global_value_ptr(THD *thd, const LEX_STRING *base)
{
DBUG_ASSERT(false);
return NULL;
......
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