mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
small code cleanup - "good ifdef is no ifdef"
This commit is contained in:
parent
81424b5bda
commit
f0cf48a0c4
6 changed files with 15 additions and 24 deletions
|
@ -82,7 +82,7 @@ static plugin_ref ha_default_plugin(THD *thd)
|
|||
{
|
||||
if (thd->variables.table_plugin)
|
||||
return thd->variables.table_plugin;
|
||||
return my_plugin_lock(thd, &global_system_variables.table_plugin);
|
||||
return my_plugin_lock(thd, global_system_variables.table_plugin);
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,13 +163,8 @@ plugin_ref ha_lock_engine(THD *thd, handlerton *hton)
|
|||
{
|
||||
if (hton)
|
||||
{
|
||||
st_plugin_int **plugin= hton2plugin + hton->slot;
|
||||
|
||||
#ifdef DBUG_OFF
|
||||
return my_plugin_lock(thd, plugin);
|
||||
#else
|
||||
return my_plugin_lock(thd, &plugin);
|
||||
#endif
|
||||
st_plugin_int *plugin= hton2plugin[hton->slot];
|
||||
return my_plugin_lock(thd, plugin_int_to_ref(plugin));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -3845,7 +3845,7 @@ uchar *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
|
|||
LEX_STRING *engine_name;
|
||||
plugin_ref plugin= thd->variables.*offset;
|
||||
if (type == OPT_GLOBAL)
|
||||
plugin= my_plugin_lock(thd, &(global_system_variables.*offset));
|
||||
plugin= my_plugin_lock(thd, global_system_variables.*offset);
|
||||
hton= plugin_data(plugin, handlerton*);
|
||||
engine_name= hton_name(hton);
|
||||
result= (uchar *) thd->strmake(engine_name->str, engine_name->length);
|
||||
|
@ -3866,7 +3866,7 @@ void sys_var_thd_storage_engine::set_default(THD *thd, enum_var_type type)
|
|||
else
|
||||
{
|
||||
value= &(thd->variables.*offset);
|
||||
new_value= my_plugin_lock(NULL, &(global_system_variables.*offset));
|
||||
new_value= my_plugin_lock(NULL, global_system_variables.*offset);
|
||||
}
|
||||
DBUG_ASSERT(new_value);
|
||||
old_value= *value;
|
||||
|
@ -3883,7 +3883,7 @@ bool sys_var_thd_storage_engine::update(THD *thd, set_var *var)
|
|||
old_value= *value;
|
||||
if (old_value != var->save_result.plugin)
|
||||
{
|
||||
*value= my_plugin_lock(NULL, &var->save_result.plugin);
|
||||
*value= my_plugin_lock(NULL, var->save_result.plugin);
|
||||
plugin_unlock(NULL, old_value);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -19,14 +19,6 @@
|
|||
#define REPORT_TO_LOG 1
|
||||
#define REPORT_TO_USER 2
|
||||
|
||||
#ifdef DBUG_OFF
|
||||
#define plugin_ref_to_int(A) A
|
||||
#define plugin_int_to_ref(A) A
|
||||
#else
|
||||
#define plugin_ref_to_int(A) (A ? A[0] : NULL)
|
||||
#define plugin_int_to_ref(A) &(A)
|
||||
#endif
|
||||
|
||||
extern struct st_mysql_plugin *mysqld_builtins[];
|
||||
|
||||
/**
|
||||
|
@ -658,13 +650,13 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO)
|
|||
}
|
||||
|
||||
|
||||
plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO)
|
||||
plugin_ref plugin_lock(THD *thd, plugin_ref ptr CALLER_INFO_PROTO)
|
||||
{
|
||||
LEX *lex= thd ? thd->lex : 0;
|
||||
plugin_ref rc;
|
||||
DBUG_ENTER("plugin_lock");
|
||||
pthread_mutex_lock(&LOCK_plugin);
|
||||
rc= my_intern_plugin_lock_ci(lex, *ptr);
|
||||
rc= my_intern_plugin_lock_ci(lex, ptr);
|
||||
pthread_mutex_unlock(&LOCK_plugin);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
|
|
@ -89,6 +89,8 @@ struct st_plugin_int
|
|||
*/
|
||||
#ifdef DBUG_OFF
|
||||
typedef struct st_plugin_int *plugin_ref;
|
||||
#define plugin_ref_to_int(A) A
|
||||
#define plugin_int_to_ref(A) A
|
||||
#define plugin_decl(pi) ((pi)->plugin)
|
||||
#define plugin_dlib(pi) ((pi)->plugin_dl)
|
||||
#define plugin_data(pi,cast) ((cast)((pi)->data))
|
||||
|
@ -97,6 +99,8 @@ typedef struct st_plugin_int *plugin_ref;
|
|||
#define plugin_equals(p1,p2) ((p1) == (p2))
|
||||
#else
|
||||
typedef struct st_plugin_int **plugin_ref;
|
||||
#define plugin_ref_to_int(A) (A ? A[0] : NULL)
|
||||
#define plugin_int_to_ref(A) &(A)
|
||||
#define plugin_decl(pi) ((pi)[0]->plugin)
|
||||
#define plugin_dlib(pi) ((pi)[0]->plugin_dl)
|
||||
#define plugin_data(pi,cast) ((cast)((pi)[0]->data))
|
||||
|
@ -120,7 +124,7 @@ extern bool plugin_is_ready(const LEX_STRING *name, int type);
|
|||
#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO)
|
||||
#define my_plugin_lock(A,B) plugin_lock(A,B CALLER_INFO)
|
||||
#define my_plugin_lock_ci(A,B) plugin_lock(A,B ORIG_CALLER_INFO)
|
||||
extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO);
|
||||
extern plugin_ref plugin_lock(THD *thd, plugin_ref ptr CALLER_INFO_PROTO);
|
||||
extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name,
|
||||
int type CALLER_INFO_PROTO);
|
||||
extern void plugin_unlock(THD *thd, plugin_ref plugin);
|
||||
|
|
|
@ -11014,7 +11014,7 @@ create_internal_tmp_table_from_heap2(THD *thd, TABLE *table,
|
|||
delete table->file;
|
||||
table->file=0;
|
||||
plugin_unlock(0, table->s->db_plugin);
|
||||
share.db_plugin= my_plugin_lock(0, &share.db_plugin);
|
||||
share.db_plugin= my_plugin_lock(0, share.db_plugin);
|
||||
new_table.s= table->s; // Keep old share
|
||||
*table= new_table;
|
||||
*table->s= share;
|
||||
|
|
|
@ -899,7 +899,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
|
|||
replacing it with a globally locked version of tmp_plugin
|
||||
*/
|
||||
plugin_unlock(NULL, share->db_plugin);
|
||||
share->db_plugin= my_plugin_lock(NULL, &tmp_plugin);
|
||||
share->db_plugin= my_plugin_lock(NULL, tmp_plugin);
|
||||
DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
|
||||
str_db_type_length, next_chunk + 2,
|
||||
ha_legacy_type(share->db_type())));
|
||||
|
|
Loading…
Reference in a new issue