summaryrefslogtreecommitdiff
path: root/storage/myisammrg
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-03-12 16:27:19 +0100
committerSergei Golubchik <serg@mariadb.org>2019-03-14 16:33:17 +0100
commit3d2d060b626a94a19480db55feecc3020440b5c3 (patch)
tree52a1c7c7add53908023d23f90a95a764bbc23d06 /storage/myisammrg
parentddfa722a03ab3649783f8798df02d94a8a8ef6e3 (diff)
downloadmariadb-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/myisammrg')
-rw-r--r--storage/myisammrg/ha_myisammrg.cc47
1 files changed, 21 insertions, 26 deletions
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index bb2ba283f36..d1a3babdb2d 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -1466,49 +1466,41 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
if (!(create_info->used_fields & HA_CREATE_USED_UNION))
{
- TABLE_LIST *child_table;
- THD *thd=current_thd;
-
- create_info->merge_list.next= &create_info->merge_list.first;
- create_info->merge_list.elements=0;
+ TABLE_LIST *child_table, *end= NULL;
+ THD *thd=ha_thd();
if (children_l != NULL)
{
- for (child_table= children_l;;
- child_table= child_table->next_global)
+ for (child_table= children_l;; child_table= child_table->next_global)
{
TABLE_LIST *ptr;
if (!(ptr= (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
- goto err;
+ DBUG_VOID_RETURN;
if (!(ptr->table_name= thd->strmake(child_table->table_name,
child_table->table_name_length)))
- goto err;
- if (child_table->db && !(ptr->db= thd->strmake(child_table->db,
- child_table->db_length)))
- goto err;
+ DBUG_VOID_RETURN;
+ if (child_table->db &&
+ !(ptr->db= thd->strmake(child_table->db, child_table->db_length)))
+ DBUG_VOID_RETURN;
- create_info->merge_list.elements++;
- (*create_info->merge_list.next)= ptr;
- create_info->merge_list.next= &ptr->next_local;
+ if (create_info->merge_list)
+ end->next_local= ptr;
+ else
+ create_info->merge_list= ptr;
+ end= ptr;
if (&child_table->next_global == children_last_l)
break;
}
}
- *create_info->merge_list.next=0;
}
if (!(create_info->used_fields & HA_CREATE_USED_INSERT_METHOD))
{
create_info->merge_insert_method = file->merge_insert_method;
}
DBUG_VOID_RETURN;
-
-err:
- create_info->merge_list.elements=0;
- create_info->merge_list.first=0;
- DBUG_VOID_RETURN;
}
@@ -1516,18 +1508,21 @@ int ha_myisammrg::create_mrg(const char *name, HA_CREATE_INFO *create_info)
{
char buff[FN_REFLEN];
const char **table_names, **pos;
- TABLE_LIST *tables= create_info->merge_list.first;
- THD *thd= current_thd;
+ TABLE_LIST *tables= create_info->merge_list;
+ THD *thd= ha_thd();
size_t dirlgt= dirname_length(name);
+ uint ntables= 0;
DBUG_ENTER("ha_myisammrg::create_mrg");
+ for (tables= create_info->merge_list; tables; tables= tables->next_local)
+ ntables++;
+
/* Allocate a table_names array in thread mem_root. */
- if (!(table_names= (const char**)
- thd->alloc((create_info->merge_list.elements+1) * sizeof(char*))))
+ if (!(pos= table_names= (const char**) thd->alloc((ntables + 1) * sizeof(char*))))
DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */
/* Create child path names. */
- for (pos= table_names; tables; tables= tables->next_local)
+ for (tables= create_info->merge_list; tables; tables= tables->next_local)
{
const char *table_name= buff;