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 /storage/maria | |
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 'storage/maria')
-rw-r--r-- | storage/maria/ma_write.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c index fde0b3a7afd..1a720101a40 100644 --- a/storage/maria/ma_write.c +++ b/storage/maria/ma_write.c @@ -1675,14 +1675,15 @@ static int keys_compare(bulk_insert_param *param, uchar *key1, uchar *key2) } -static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param) +static void keys_free(void* key_arg, TREE_FREE mode, void *param_arg) { /* Probably I can use info->lastkey here, but I'm not sure, and to be safe I'd better use local lastkey. */ + bulk_insert_param *param= (bulk_insert_param*)param_arg; MARIA_SHARE *share= param->info->s; - uchar lastkey[MARIA_MAX_KEY_BUFF]; + uchar lastkey[MARIA_MAX_KEY_BUFF], *key= (uchar*)key_arg; uint keylen; MARIA_KEYDEF *keyinfo= share->keyinfo + param->keynr; MARIA_KEY tmp_key; @@ -1694,7 +1695,7 @@ static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param) mysql_rwlock_wrlock(&keyinfo->root_lock); keyinfo->version++; } - return 0; + return; case free_free: /* Note: keylen doesn't contain transid lengths */ keylen= _ma_keylength(keyinfo, key); @@ -1709,13 +1710,14 @@ static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param) copying middle key up if tree is growing */ memcpy(lastkey, key, tmp_key.data_length + tmp_key.ref_length); - return _ma_ck_write_btree(param->info, &tmp_key); + _ma_ck_write_btree(param->info, &tmp_key); + return; case free_end: if (share->lock_key_trees) mysql_rwlock_unlock(&keyinfo->root_lock); - return 0; + return; } - return 1; + return; } @@ -1771,8 +1773,7 @@ int maria_init_bulk_insert(MARIA_HA *info, size_t cache_size, ha_rows rows) init_tree(&info->bulk_insert[i], cache_size * key[i].maxlength, cache_size * key[i].maxlength, 0, - (qsort_cmp2)keys_compare, - (tree_element_free) keys_free, (void *)params++, MYF(0)); + (qsort_cmp2) keys_compare, keys_free, (void *)params++, MYF(0)); } else info->bulk_insert[i].root=0; |