diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index e5e8dddd618..0825225547c 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -2082,8 +2082,7 @@ int ha_tokudb::remove_frm_data(DB *db, DB_TXN *txn) { return remove_from_status(db, hatoku_frm_data, txn); } -static int -smart_dbt_callback_verify_frm (DBT const *key, DBT const *row, void *context) { +static int smart_dbt_callback_verify_frm (DBT const *key, DBT const *row, void *context) { DBT* stored_frm = (DBT *)context; stored_frm->size = row->size; stored_frm->data = (uchar *)tokudb_my_malloc(row->size, MYF(MY_WME)); @@ -2096,19 +2095,22 @@ int ha_tokudb::verify_frm_data(const char* frm_name, DB_TXN* txn) { TOKUDB_HANDLER_DBUG_ENTER("%s", frm_name); uchar* mysql_frm_data = NULL; size_t mysql_frm_len = 0; - DBT key, stored_frm; + DBT key = {}; + DBT stored_frm = {}; int error = 0; HA_METADATA_KEY curr_key = hatoku_frm_data; - memset(&key, 0, sizeof(key)); - memset(&stored_frm, 0, sizeof(&stored_frm)); // get the frm data from MySQL #if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099 error = table_share->read_frm_image((const uchar**)&mysql_frm_data,&mysql_frm_len); - if (error) { goto cleanup; } + if (error) { + goto cleanup; + } #else error = readfrm(frm_name,&mysql_frm_data,&mysql_frm_len); - if (error) { goto cleanup; } + if (error) { + goto cleanup; + } #endif key.data = &curr_key; @@ -2123,20 +2125,13 @@ int ha_tokudb::verify_frm_data(const char* frm_name, DB_TXN* txn) { ); if (error == DB_NOTFOUND) { // if not found, write it - error = write_frm_data( - share->status_block, - txn, - frm_name - ); + error = write_frm_data(share->status_block, txn, frm_name); goto cleanup; - } - else if (error) { + } else if (error) { goto cleanup; } - if (stored_frm.size != mysql_frm_len || - memcmp(stored_frm.data, mysql_frm_data, stored_frm.size)) - { + if (stored_frm.size != mysql_frm_len || memcmp(stored_frm.data, mysql_frm_data, stored_frm.size)) { error = HA_ERR_TABLE_DEF_CHANGED; goto cleanup; } diff --git a/storage/tokudb/hatoku_cmp.h b/storage/tokudb/hatoku_cmp.h index ca816ac52d8..6ecd0968db7 100644 --- a/storage/tokudb/hatoku_cmp.h +++ b/storage/tokudb/hatoku_cmp.h @@ -229,11 +229,7 @@ static void get_blob_field_info( uint32_t num_offset_bytes ); -static inline uint32_t get_blob_field_len( - const uchar* from_tokudb, - uint32_t len_bytes - ) -{ +static inline uint32_t get_blob_field_len(const uchar* from_tokudb, uint32_t len_bytes) { uint32_t length = 0; switch (len_bytes) { case (1): @@ -255,13 +251,7 @@ static inline uint32_t get_blob_field_len( } -static inline const uchar* unpack_toku_field_blob( - uchar *to_mysql, - const uchar* from_tokudb, - uint32_t len_bytes, - bool skip - ) -{ +static inline const uchar* unpack_toku_field_blob(uchar *to_mysql, const uchar* from_tokudb, uint32_t len_bytes, bool skip) { uint32_t length = 0; const uchar* data_ptr = NULL; if (!skip) { @@ -271,9 +261,9 @@ static inline const uchar* unpack_toku_field_blob( data_ptr = from_tokudb + len_bytes; if (!skip) { - memcpy(to_mysql + len_bytes, (uchar *)(&data_ptr), sizeof(uchar *)); + memcpy(to_mysql + len_bytes, (uchar *)(&data_ptr), sizeof data_ptr); } - return (from_tokudb + len_bytes + length); + return from_tokudb + len_bytes + length; } static inline uint get_null_offset(TABLE* table, Field* field) { diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc index e4b79a5c1f6..6a280995e03 100644 --- a/storage/tokudb/hatoku_hton.cc +++ b/storage/tokudb/hatoku_hton.cc @@ -974,9 +974,8 @@ static int tokudb_discover3(handlerton *hton, THD* thd, const char *db, const ch DB* status_db = NULL; DB_TXN* txn = NULL; HA_METADATA_KEY curr_key = hatoku_frm_data; - DBT key, value; - memset(&key, 0, sizeof(key)); - memset(&value, 0, sizeof(&value)); + DBT key = {}; + DBT value = {}; bool do_commit; #if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099