diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-03-12 16:27:19 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-03-14 16:33:17 +0100 |
commit | 3d2d060b626a94a19480db55feecc3020440b5c3 (patch) | |
tree | 52a1c7c7add53908023d23f90a95a764bbc23d06 /sql | |
parent | ddfa722a03ab3649783f8798df02d94a8a8ef6e3 (diff) | |
download | mariadb-git-3d2d060b626a94a19480db55feecc3020440b5c3.tar.gz |
fix gcc 8 compiler warnings
There were two newly enabled warnings:
1. cast for a function pointers. Affected sql_analyse.h, mi_write.c
and ma_write.cc, mf_iocache-t.cc, mysqlbinlog.cc, encryption.cc, etc
2. memcpy/memset of nontrivial structures. Fixed as:
* the warning disabled for InnoDB
* TABLE, TABLE_SHARE, and TABLE_LIST got a new method reset() which
does the bzero(), which is safe for these classes, but any other
bzero() will still cause a warning
* Table_scope_and_contents_source_st uses `TABLE_LIST *` (trivial)
instead of `SQL_I_List<TABLE_LIST>` (not trivial) so it's safe to
bzero now.
* added casts in debug_sync.cc and sql_select.cc (for JOIN)
* move assignment method for MDL_request instead of memcpy()
* PARTIAL_INDEX_INTERSECT_INFO::init() instead of bzero()
* remove constructor from READ_RECORD() to make it trivial
* replace some memcpy() with c++ copy assignments
Diffstat (limited to 'sql')
-rw-r--r-- | sql/debug_sync.cc | 6 | ||||
-rw-r--r-- | sql/encryption.cc | 15 | ||||
-rw-r--r-- | sql/handler.h | 2 | ||||
-rw-r--r-- | sql/mdl.h | 10 | ||||
-rw-r--r-- | sql/opt_range.cc | 16 | ||||
-rw-r--r-- | sql/partition_info.cc | 11 | ||||
-rw-r--r-- | sql/records.h | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 4 | ||||
-rw-r--r-- | sql/sql_alter.cc | 10 | ||||
-rw-r--r-- | sql/sql_analyse.cc | 4 | ||||
-rw-r--r-- | sql/sql_analyse.h | 5 | ||||
-rw-r--r-- | sql/sql_handler.cc | 7 | ||||
-rw-r--r-- | sql/sql_insert.cc | 6 | ||||
-rw-r--r-- | sql/sql_parse.cc | 5 | ||||
-rw-r--r-- | sql/sql_select.cc | 12 | ||||
-rw-r--r-- | sql/sql_select.h | 1 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/sql_trigger.cc | 4 | ||||
-rw-r--r-- | sql/sql_view.cc | 5 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 4 | ||||
-rw-r--r-- | sql/table.h | 15 | ||||
-rw-r--r-- | sql/tztime.cc | 11 |
22 files changed, 85 insertions, 72 deletions
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc index f6291ca7acc..3dfbcdbcf81 100644 --- a/sql/debug_sync.cc +++ b/sql/debug_sync.cc @@ -584,7 +584,7 @@ static void debug_sync_remove_action(st_debug_sync_control *ds_control, memmove(save_action, action, sizeof(st_debug_sync_action)); /* Move actions down. */ - memmove(ds_control->ds_action + dsp_idx, + memmove((void*)(ds_control->ds_action + dsp_idx), ds_control->ds_action + dsp_idx + 1, (ds_control->ds_active - dsp_idx) * sizeof(st_debug_sync_action)); @@ -595,8 +595,8 @@ static void debug_sync_remove_action(st_debug_sync_control *ds_control, produced by the shift. Again do not use an assignment operator to avoid string allocation/copy. */ - memmove(ds_control->ds_action + ds_control->ds_active, save_action, - sizeof(st_debug_sync_action)); + memmove((void*)(ds_control->ds_action + ds_control->ds_active), + save_action, sizeof(st_debug_sync_action)); } DBUG_VOID_RETURN; diff --git a/sql/encryption.cc b/sql/encryption.cc index 52eab262570..e5b54633066 100644 --- a/sql/encryption.cc +++ b/sql/encryption.cc @@ -25,6 +25,10 @@ struct encryption_service_st encryption_handler; extern "C" { +uint no_get_key(uint, uint, uchar*, uint*) +{ + return ENCRYPTION_KEY_VERSION_INVALID; +} uint no_key(uint) { return ENCRYPTION_KEY_VERSION_INVALID; @@ -47,6 +51,11 @@ static unsigned int get_length(unsigned int slen, unsigned int key_id, return my_aes_get_size(MY_AES_CBC, slen); } +uint ctx_size(unsigned int, unsigned int) +{ + return MY_AES_CTX_SIZE; +} + } /* extern "C" */ int initialize_encryption_plugin(st_plugin_int *plugin) @@ -72,8 +81,7 @@ int initialize_encryption_plugin(st_plugin_int *plugin) if (handle->crypt_ctx_size) encryption_handler.encryption_ctx_size_func= handle->crypt_ctx_size; else - encryption_handler.encryption_ctx_size_func= - (uint (*)(unsigned int, unsigned int))my_aes_ctx_size; + encryption_handler.encryption_ctx_size_func= ctx_size; encryption_handler.encryption_ctx_init_func= handle->crypt_ctx_init ? handle->crypt_ctx_init : ctx_init; @@ -102,8 +110,7 @@ int finalize_encryption_plugin(st_plugin_int *plugin) if (used) { - encryption_handler.encryption_key_get_func= - (uint (*)(uint, uint, uchar*, uint*))no_key; + encryption_handler.encryption_key_get_func= no_get_key; encryption_handler.encryption_key_get_latest_version_func= no_key; encryption_handler.encryption_ctx_size_func= zero_size; } diff --git a/sql/handler.h b/sql/handler.h index 792cce281f6..af492e75da6 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1687,7 +1687,6 @@ struct Table_scope_and_contents_source_st uint options; /* OR of HA_CREATE_ options */ uint merge_insert_method; uint extra_size; /* length of extra data segment */ - SQL_I_List<TABLE_LIST> merge_list; handlerton *db_type; /** Row type of the table definition. @@ -1716,6 +1715,7 @@ struct Table_scope_and_contents_source_st TABLE_LIST *pos_in_locked_tables; MDL_ticket *mdl_ticket; bool table_was_deleted; + TABLE_LIST *merge_list; void init() { diff --git a/sql/mdl.h b/sql/mdl.h index 7961f1f24b2..15a1976876b 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -475,6 +475,16 @@ public: DBUG_ASSERT(ticket == NULL); type= type_arg; } + void move_from(MDL_request &from) + { + type= from.type; + duration= from.duration; + ticket= from.ticket; + next_in_list= from.next_in_list; + prev_in_list= from.prev_in_list; + key.mdl_key_init(&from.key); + from.ticket= NULL; // that's what "move" means + } /* This is to work around the ugliness of TABLE_LIST diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 46b10b559b2..2f76f918e34 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1340,8 +1340,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() - Use rowids from unique to run a disk-ordered sweep */ -QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT(THD *thd_param, - TABLE *table) +QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT(THD *thd_param, TABLE *table) :unique(NULL), pk_quick_select(NULL), thd(thd_param) { DBUG_ENTER("QUICK_INDEX_SORT_SELECT::QUICK_INDEX_SORT_SELECT"); @@ -5111,6 +5110,16 @@ typedef struct st_partial_index_intersect_info key_map filtered_scans; /* scans to be filtered by cpk conditions */ MY_BITMAP *intersect_fields; /* bitmap of fields used in intersection */ + + void init() + { + common_info= NULL; + intersect_fields= NULL; + records_sent_to_unique= records= length= in_memory= use_cpk_filter= 0; + cost= index_read_cost= in_memory_cost= 0.0; + filtered_scans.init(); + filtered_scans.clear_all(); + } } PARTIAL_INDEX_INTERSECT_INFO; @@ -5247,8 +5256,7 @@ bool prepare_search_best_index_intersect(PARAM *param, if (!n_index_scans) return 1; - bzero(init, sizeof(*init)); - init->filtered_scans.init(); + init->init(); init->common_info= common; init->cost= cutoff_cost; diff --git a/sql/partition_info.cc b/sql/partition_info.cc index c633ea708d0..892b7e8bd05 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -47,7 +47,7 @@ partition_info *partition_info::get_clone(THD *thd) mem_alloc_error(sizeof(partition_info)); DBUG_RETURN(NULL); } - memcpy(clone, this, sizeof(partition_info)); + *clone= *this; memset(&(clone->read_partitions), 0, sizeof(clone->read_partitions)); memset(&(clone->lock_partitions), 0, sizeof(clone->lock_partitions)); clone->bitmaps_are_initialized= FALSE; @@ -63,7 +63,7 @@ partition_info *partition_info::get_clone(THD *thd) mem_alloc_error(sizeof(partition_element)); DBUG_RETURN(NULL); } - memcpy(part_clone, part, sizeof(partition_element)); + *part_clone= *part; part_clone->subpartitions.empty(); while ((subpart= (subpart_it++))) { @@ -73,7 +73,7 @@ partition_info *partition_info::get_clone(THD *thd) mem_alloc_error(sizeof(partition_element)); DBUG_RETURN(NULL); } - memcpy(subpart_clone, subpart, sizeof(partition_element)); + *subpart_clone= *subpart; part_clone->subpartitions.push_back(subpart_clone, mem_root); } clone->partitions.push_back(part_clone, mem_root); @@ -1897,12 +1897,11 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag) TABLE_LIST table_list; THD *thd= current_thd; - bzero(&table_list, sizeof(table_list)); + table_list.reset(); table_list.db= table_arg->s->db.str; table_list.table_name= table_arg->s->table_name.str; - if (check_single_table_access(thd, - SELECT_ACL, &table_list, TRUE)) + if (check_single_table_access(thd, SELECT_ACL, &table_list, TRUE)) { my_message(ER_NO_PARTITION_FOR_GIVEN_VALUE, ER_THD(thd, ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), errflag); diff --git a/sql/records.h b/sql/records.h index a3f0b5eb084..b55fbc22f55 100644 --- a/sql/records.h +++ b/sql/records.h @@ -69,8 +69,6 @@ struct READ_RECORD */ Copy_field *copy_field; Copy_field *copy_field_end; -public: - READ_RECORD() {} }; bool init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form, diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 9110834b449..ff18c1d4c10 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -8538,11 +8538,13 @@ static int open_grant_tables(THD *thd, TABLE_LIST *tables, } int prev= -1; - bzero(tables, sizeof(TABLE_LIST) * TABLES_MAX); for (int cur=TABLES_MAX-1, mask= 1 << cur; mask; cur--, mask >>= 1) { if ((tables_to_open & mask) == 0) + { + tables[cur].table= NULL; continue; + } tables[cur].init_one_table(C_STRING_WITH_LEN("mysql"), acl_table_names[cur].str, acl_table_names[cur].length, diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 243cf4c790f..ddac271146e 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -233,7 +233,7 @@ bool Sql_cmd_alter_table::execute(THD *thd) DBUG_RETURN(TRUE); /* purecov: inspected */ /* If it is a merge table, check privileges for merge children. */ - if (create_info.merge_list.first) + if (create_info.merge_list) { /* The user must have (SELECT_ACL | UPDATE_ACL | DELETE_ACL) on the @@ -271,7 +271,7 @@ bool Sql_cmd_alter_table::execute(THD *thd) */ if (check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL, - create_info.merge_list.first, FALSE, UINT_MAX, FALSE)) + create_info.merge_list, FALSE, UINT_MAX, FALSE)) DBUG_RETURN(TRUE); } @@ -282,9 +282,9 @@ bool Sql_cmd_alter_table::execute(THD *thd) { // Rename of table TABLE_LIST tmp_table; - memset(&tmp_table, 0, sizeof(tmp_table)); - tmp_table.table_name= lex->name.str; - tmp_table.db= select_lex->db; + tmp_table.init_one_table(select_lex->db, strlen(select_lex->db), + lex->name.str, lex->name.length, + lex->name.str, TL_IGNORE); tmp_table.grant.privilege= priv; if (check_grant(thd, INSERT_ACL | CREATE_ACL, &tmp_table, FALSE, UINT_MAX, FALSE)) diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 1f801a33dcd..45f4f87f172 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -298,9 +298,9 @@ bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num) } // get_ev_num_info -void free_string(String *s) +void free_string(void* str, TREE_FREE, void*) { - s->free(); + ((String*)str)->free(); } diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index 820877f2a69..738737f0edc 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -68,7 +68,7 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)), int compare_decimal2(int* len, const char *s, const char *t); Procedure *proc_analyse_init(THD *thd, ORDER *param, select_result *result, List<Item> &field_list); -void free_string(String*); +void free_string(void* str, TREE_FREE, void*); class analyse; class field_info :public Sql_alloc @@ -121,8 +121,7 @@ public: must_be_blob(0), was_zero_fill(0), was_maybe_zerofill(0), can_be_still_num(1) { init_tree(&tree, 0, 0, sizeof(String), (qsort_cmp2) sortcmp2, - (tree_element_free) free_string, NULL, - MYF(MY_THREAD_SPECIFIC)); }; + free_string, NULL, MYF(MY_THREAD_SPECIFIC)); }; void add(); void get_opt_type(String*, ha_rows); diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 5a022ba72cf..bc6119b9a9c 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -359,8 +359,6 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen) sql_handler->reset(); } sql_handler->table= table; - memcpy(&sql_handler->mdl_request, &tables->mdl_request, - sizeof(tables->mdl_request)); if (!(sql_handler->lock= get_lock_data(thd, &sql_handler->table, 1, GET_LOCK_STORE_LOCKS))) @@ -374,6 +372,8 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen) if (error) goto err; + sql_handler->mdl_request.move_from(tables->mdl_request); + /* Always read all columns */ table->read_set= &table->s->all_set; if (table->vcol_set) @@ -403,9 +403,6 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen) */ table->open_by_handler= 1; - /* Safety, cleanup the pointer to satisfy MDL assertions. */ - tables->mdl_request.ticket= NULL; - if (! reopen) my_ok(thd); DBUG_PRINT("exit",("OK")); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 6455818993d..1745c6b4aaa 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4319,14 +4319,12 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) DBUG_ASSERT(thd->is_current_stmt_binlog_format_row()); DBUG_ASSERT(tables && *tables && count > 0); - char buf[2048]; - String query(buf, sizeof(buf), system_charset_info); + StringBuffer<2048> query(system_charset_info); int result; TABLE_LIST tmp_table_list; - memset(&tmp_table_list, 0, sizeof(tmp_table_list)); + tmp_table_list.reset(); tmp_table_list.table = *tables; - query.length(0); // Have to zero it since constructor doesn't result= show_create_table(thd, &tmp_table_list, &query, create_info, WITH_DB_NAME); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b6591c4d8c3..6b289a9fee9 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -8948,7 +8948,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, goto err; /* If it is a merge table, check privileges for merge children. */ - if (lex->create_info.merge_list.first) + if (lex->create_info.merge_list) { /* The user must have (SELECT_ACL | UPDATE_ACL | DELETE_ACL) on the @@ -8986,8 +8986,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, */ if (check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL, - lex->create_info.merge_list.first, - FALSE, UINT_MAX, FALSE)) + lex->create_info.merge_list, FALSE, UINT_MAX, FALSE)) goto err; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 155e261ac34..280de2b2ef1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2329,7 +2329,7 @@ void JOIN::restore_tmp() { DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join)); DBUG_ASSERT(tmp_join != this); - memcpy(tmp_join, this, (size_t) sizeof(JOIN)); + memcpy((void*)tmp_join, this, (size_t) sizeof(JOIN)); } @@ -3610,7 +3610,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list, DBUG_RETURN(1); /* The following should be optimized to only clear critical things */ - bzero(stat, sizeof(JOIN_TAB)* table_count); + bzero((void*)stat, sizeof(JOIN_TAB)* table_count); /* Initialize POSITION objects */ for (i=0 ; i <= table_count ; i++) (void) new ((char*) (join->positions + i)) POSITION; @@ -8758,7 +8758,7 @@ get_best_combination(JOIN *join) 1. Put into main join order a JOIN_TAB that represents a lookup or scan in the temptable. */ - bzero(j, sizeof(JOIN_TAB)); + bzero((void*)j, sizeof(JOIN_TAB)); j->join= join; j->table= NULL; //temporary way to tell SJM tables from others. j->ref.key = -1; @@ -9360,7 +9360,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table) row_limit= unit->select_limit_cnt; do_send_rows= row_limit ? 1 : 0; - bzero(join_tab, sizeof(JOIN_TAB)); + bzero((void*)join_tab, sizeof(JOIN_TAB)); join_tab->table=temp_table; join_tab->set_select_cond(NULL, __LINE__); join_tab->type= JT_ALL; /* Map through all records */ @@ -17275,11 +17275,11 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list) NullS)) return 0; - bzero(table, sizeof(*table)); - bzero(share, sizeof(*share)); + table->reset(); table->field= field; table->s= share; table->temp_pool_slot= MY_BIT_NONE; + share->reset(); share->blob_field= blob_field; share->fields= field_count; setup_tmp_table_column_bitmaps(table, bitmaps); diff --git a/sql/sql_select.h b/sql/sql_select.h index 8c55528e120..266fe7a7066 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -199,7 +199,6 @@ class SJ_TMP_TABLE; class JOIN_TAB_RANGE; typedef struct st_join_table { - st_join_table() {} /* Remove gcc warning */ TABLE *table; KEYUSE *keyuse; /**< pointer to first used key */ KEY *hj_key; /**< descriptor of the used best hash join key diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e1c599102c6..73f0f564c4c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -6266,7 +6266,7 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables, { TABLE_LIST table_list; uint view_access; - memset(&table_list, 0, sizeof(table_list)); + table_list.reset(); table_list.db= tables->db; table_list.table_name= tables->table_name; table_list.grant.privilege= thd->col_access; diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 14e1e84739b..f6dd48131bf 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1818,7 +1818,7 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, char *db, char *name) bool result= 0; DBUG_ENTER("drop_all_triggers"); - bzero(&table, sizeof(table)); + table.reset(); init_sql_alloc(&table.mem_root, 8192, 0, MYF(0)); if (Table_triggers_list::check_n_load(thd, db, name, &table, 1)) @@ -2038,7 +2038,7 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, LEX_STRING *err_trigname; DBUG_ENTER("change_table_name"); - bzero(&table, sizeof(table)); + table.reset(); init_sql_alloc(&table.mem_root, 8192, 0, MYF(0)); /* diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 8fa03f23ca1..4d7c3de9337 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -214,7 +214,8 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view) LEX *lex= thd->lex; TABLE_LIST decoy; - memcpy (&decoy, view, sizeof (TABLE_LIST)); + decoy= *view; + decoy.mdl_request.key.mdl_key_init(&view->mdl_request.key); if (tdc_open_view(thd, &decoy, decoy.alias, OPEN_VIEW_NO_PARSE)) return TRUE; @@ -2133,7 +2134,7 @@ mysql_rename_view(THD *thd, view definition parsing or use temporary 'view_def' object for it. */ - bzero(&view_def, sizeof(view_def)); + view_def.reset(); view_def.timestamp.str= view_def.timestamp_buffer; view_def.view_suid= TRUE; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c3a34f23ac9..5111f0690ab 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5671,7 +5671,7 @@ create_table_option: from the global list. */ LEX *lex=Lex; - lex->create_info.merge_list= lex->select_lex.table_list; + lex->create_info.merge_list= lex->select_lex.table_list.first; lex->select_lex.table_list= lex->save_list; /* When excluding union list from the global list we assume that @@ -5680,7 +5680,7 @@ create_table_option: */ TABLE_LIST *last_non_sel_table= lex->create_last_non_select_table; DBUG_ASSERT(last_non_sel_table->next_global == - lex->create_info.merge_list.first); + lex->create_info.merge_list); last_non_sel_table->next_global= 0; Lex->query_tables_last= &last_non_sel_table->next_global; diff --git a/sql/table.h b/sql/table.h index de10a966d1b..afe3220c943 100644 --- a/sql/table.h +++ b/sql/table.h @@ -789,6 +789,8 @@ struct TABLE_SHARE /** Instrumentation for this table share. */ PSI_table_share *m_psi; + inline void reset() { bzero((void*)this, sizeof(*this)); } + /* Set share's table cache key and update its db and table name appropriately. @@ -1337,6 +1339,7 @@ public: bool histograms_are_read; MDL_ticket *mdl_ticket; + inline void reset() { bzero((void*)this, sizeof(*this)); } void init(THD *thd, TABLE_LIST *tl); bool fill_item_list(List<Item> *item_list) const; void reset_item_list(List<Item> *item_list) const; @@ -1763,6 +1766,7 @@ struct TABLE_LIST Prepare TABLE_LIST that consists of one table instance to use in open_and_lock_tables */ + inline void reset() { bzero((void*)this, sizeof(*this)); } inline void init_one_table(const char *db_name_arg, size_t db_length_arg, const char *table_name_arg, @@ -1778,7 +1782,7 @@ struct TABLE_LIST else mdl_type= MDL_SHARED_READ; - bzero((char*) this, sizeof(*this)); + reset(); db= (char*) db_name_arg; db_length= db_length_arg; table_name= (char*) table_name_arg; @@ -2272,8 +2276,7 @@ struct TABLE_LIST @sa check_and_update_table_version() */ - inline - bool is_table_ref_id_equal(TABLE_SHARE *s) const + inline bool is_table_ref_id_equal(TABLE_SHARE *s) const { return (m_table_ref_type == s->get_table_ref_type() && m_table_ref_version == s->get_table_ref_version()); @@ -2285,12 +2288,10 @@ struct TABLE_LIST @sa check_and_update_table_version() */ - inline - void set_table_ref_id(TABLE_SHARE *s) + inline void set_table_ref_id(TABLE_SHARE *s) { set_table_ref_id(s->get_table_ref_type(), s->get_table_ref_version()); } - inline - void set_table_ref_id(enum_table_ref_type table_ref_type_arg, + inline void set_table_ref_id(enum_table_ref_type table_ref_type_arg, ulong table_ref_version_arg) { m_table_ref_type= table_ref_type_arg; diff --git a/sql/tztime.cc b/sql/tztime.cc index 279d5990460..60a3ceafe0a 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1537,16 +1537,11 @@ my_offset_tzs_get_key(Time_zone_offset *entry, static void tz_init_table_list(TABLE_LIST *tz_tabs) { - bzero(tz_tabs, sizeof(TABLE_LIST) * MY_TZ_TABLES_COUNT); - for (int i= 0; i < MY_TZ_TABLES_COUNT; i++) { - tz_tabs[i].alias= tz_tabs[i].table_name= tz_tables_names[i].str; - tz_tabs[i].table_name_length= tz_tables_names[i].length; - tz_tabs[i].db= tz_tables_db_name.str; - tz_tabs[i].db_length= tz_tables_db_name.length; - tz_tabs[i].lock_type= TL_READ; - + tz_tabs[i].init_one_table(tz_tables_db_name.str, tz_tables_db_name.length, + tz_tables_names[i].str, tz_tables_names[i].length, + NULL, TL_READ); if (i != MY_TZ_TABLES_COUNT - 1) tz_tabs[i].next_global= tz_tabs[i].next_local= &tz_tabs[i+1]; if (i != 0) |