Commit 391e60b2 authored by Marko Mäkelä's avatar Marko Mäkelä

Fix -Wclass-memaccess warnings in InnoDB

parent 814ae57d
......@@ -2214,8 +2214,8 @@ buf_page_realloc(
if (buf_page_can_relocate(&block->page)) {
mutex_enter(&new_block->mutex);
memcpy(new_block->frame, block->frame, UNIV_PAGE_SIZE);
memcpy(&new_block->page, &block->page, sizeof block->page);
memcpy(new_block->frame, block->frame, srv_page_size);
new (&new_block->page) buf_page_t(block->page);
/* relocate LRU list */
ut_ad(block->page.in_LRU_list);
......
......@@ -662,7 +662,7 @@ rtr_adjust_upper_level(
/* Create a memory heap where the data tuple is stored */
heap = mem_heap_create(1024);
memset(&cursor, 0, sizeof(cursor));
cursor.init();
cursor.thr = sea_cur->thr;
......@@ -1379,7 +1379,7 @@ rtr_ins_enlarge_mbr(
rtr_page_cal_mbr(index, block, &new_mbr, heap);
/* Get father block. */
memset(&cursor, 0, sizeof(cursor));
cursor.init();
offsets = rtr_page_get_father_block(
NULL, heap, index, block, mtr, btr_cur, &cursor);
......
......@@ -1548,7 +1548,7 @@ rtr_copy_buf(
will be copied. It is also undefined what will happen with the
newly memcpy()ed mutex if the source mutex was acquired by
(another) thread while it was copied. */
memcpy(&matches->block.page, &block->page, sizeof(buf_page_t));
new (&matches->block.page) buf_page_t(block->page);
matches->block.frame = block->frame;
matches->block.unzip_LRU = block->unzip_LRU;
......
......@@ -926,6 +926,26 @@ struct btr_cur_t {
rtr_info_t* rtr_info; /*!< rtree search info */
btr_cur_t():thr(NULL), rtr_info(NULL) {}
/* default values */
/** Zero-initialize all fields */
void init()
{
index = NULL;
memset(&page_cur, 0, sizeof page_cur);
purge_node = NULL;
left_block = NULL;
thr = NULL;
flag = btr_cur_method(0);
tree_height = 0;
up_match = 0;
up_bytes = 0;
low_match = 0;
low_bytes = 0;
n_fields = 0;
n_bytes = 0;
fold = 0;
path_arr = NULL;
rtr_info = NULL;
}
};
/******************************************************//**
......
......@@ -543,6 +543,18 @@ struct btr_pcur_t{
/** old_rec_buf size if old_rec_buf is not NULL */
ulint buf_size;
btr_pcur_t() :
btr_cur(), latch_mode(0), old_stored(false), old_rec(NULL),
old_n_fields(0), rel_pos(btr_pcur_pos_t(0)),
block_when_stored(NULL),
modify_clock(0), withdraw_clock(0),
pos_state(BTR_PCUR_NOT_POSITIONED),
search_mode(PAGE_CUR_UNSUPP), trx_if_known(NULL),
old_rec_buf(NULL), buf_size(0)
{
btr_cur.init();
}
/** Return the index of this persistent cursor */
dict_index_t* index() const { return(btr_cur.index); }
};
......
/*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -202,8 +202,6 @@ row_undo_ins_remove_sec_low(
enum row_search_result search_result;
const bool modify_leaf = mode == BTR_MODIFY_LEAF;
memset(&pcur, 0, sizeof(pcur));
row_mtr_start(&mtr, index, !modify_leaf);
if (modify_leaf) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment