Fix -Wclass-memaccess in WSREP,InnoDB,XtraDB
This commit is contained in:
parent
0d3972c6be
commit
769f6d2db7
@ -460,6 +460,21 @@ struct datafile_cur_t {
|
||||
size_t buf_size;
|
||||
size_t buf_read;
|
||||
size_t buf_offset;
|
||||
|
||||
explicit datafile_cur_t(const char* filename = NULL) :
|
||||
file(), thread_n(0), orig_buf(NULL), buf(NULL), buf_size(0),
|
||||
buf_read(0), buf_offset(0)
|
||||
{
|
||||
memset(rel_path, 0, sizeof rel_path);
|
||||
if (filename) {
|
||||
strncpy(abs_path, filename, sizeof abs_path);
|
||||
abs_path[(sizeof abs_path) - 1] = 0;
|
||||
} else {
|
||||
abs_path[0] = '\0';
|
||||
}
|
||||
rel_path[0] = '\0';
|
||||
memset(&statinfo, 0, sizeof statinfo);
|
||||
}
|
||||
};
|
||||
|
||||
static
|
||||
@ -478,9 +493,7 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n)
|
||||
{
|
||||
ulint success;
|
||||
|
||||
memset(cursor, 0, sizeof(datafile_cur_t));
|
||||
|
||||
strncpy(cursor->abs_path, file, sizeof(cursor->abs_path));
|
||||
new (cursor) datafile_cur_t(file);
|
||||
|
||||
/* Get the relative path for the destination tablespace name, i.e. the
|
||||
one that can be appended to the backup root directory. Non-system
|
||||
|
@ -179,8 +179,7 @@ xb_write_galera_info(bool incremental_prepare)
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&xid, 0, sizeof(xid));
|
||||
xid.formatID = -1;
|
||||
xid.null();
|
||||
|
||||
if (!trx_sys_read_wsrep_checkpoint(&xid)) {
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define HANDLER_INCLUDED
|
||||
/*
|
||||
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2016, MariaDB
|
||||
Copyright (c) 2009, 2018, MariaDB
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
@ -602,7 +602,7 @@ struct xid_t {
|
||||
bqual_length= b;
|
||||
memcpy(data, d, g+b);
|
||||
}
|
||||
bool is_null() { return formatID == -1; }
|
||||
bool is_null() const { return formatID == -1; }
|
||||
void null() { formatID= -1; }
|
||||
my_xid quick_get_my_xid()
|
||||
{
|
||||
|
@ -129,12 +129,11 @@ void wsrep_get_SE_checkpoint(wsrep_uuid_t& uuid, wsrep_seqno_t& seqno)
|
||||
seqno= WSREP_SEQNO_UNDEFINED;
|
||||
|
||||
XID xid;
|
||||
memset(&xid, 0, sizeof(xid));
|
||||
xid.formatID= -1;
|
||||
xid.null();
|
||||
|
||||
wsrep_get_SE_checkpoint(xid);
|
||||
|
||||
if (xid.formatID == -1) return; // nil XID
|
||||
if (xid.is_null()) return;
|
||||
|
||||
if (!wsrep_is_wsrep_xid(&xid))
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 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
|
||||
@ -95,10 +95,7 @@ dict_stats_pool_init()
|
||||
/*****************************************************************//**
|
||||
Free the resources occupied by the recalc pool, called once during
|
||||
thread de-initialization. */
|
||||
static
|
||||
void
|
||||
dict_stats_pool_deinit()
|
||||
/*====================*/
|
||||
static void dict_stats_pool_deinit()
|
||||
{
|
||||
ut_ad(!srv_read_only_mode);
|
||||
|
||||
@ -114,9 +111,7 @@ dict_stats_pool_deinit()
|
||||
*/
|
||||
recalc_pool_t recalc_empty_pool;
|
||||
defrag_pool_t defrag_empty_pool;
|
||||
memset(&recalc_empty_pool, 0, sizeof(recalc_pool_t));
|
||||
memset(&defrag_empty_pool, 0, sizeof(defrag_pool_t));
|
||||
recalc_pool.swap(recalc_empty_pool);
|
||||
recalc_pool.swap(recalc_empty_pool);
|
||||
defrag_pool.swap(defrag_empty_pool);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 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
|
||||
@ -347,7 +347,7 @@ trx_sys_update_wsrep_checkpoint(
|
||||
mtr_t* mtr)
|
||||
{
|
||||
#ifdef UNIV_DEBUG
|
||||
if (xid->formatID != -1
|
||||
if (!xid->is_null()
|
||||
&& mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
|
||||
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD)
|
||||
== TRX_SYS_WSREP_XID_MAGIC_N) {
|
||||
@ -368,7 +368,7 @@ trx_sys_update_wsrep_checkpoint(
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
ut_ad(xid && mtr);
|
||||
ut_a(xid->formatID == -1 || wsrep_is_wsrep_xid((const XID *)xid));
|
||||
ut_a(xid->is_null() || wsrep_is_wsrep_xid((const XID *)xid));
|
||||
|
||||
if (mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
|
||||
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD)
|
||||
@ -417,8 +417,10 @@ trx_sys_read_wsrep_checkpoint(XID* xid)
|
||||
if ((magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
|
||||
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD))
|
||||
!= TRX_SYS_WSREP_XID_MAGIC_N) {
|
||||
memset(xid, 0, sizeof(*xid));
|
||||
xid->formatID = -1;
|
||||
xid->null();
|
||||
xid->gtrid_length = 0;
|
||||
xid->bqual_length = 0;
|
||||
memset(xid->data, 0, sizeof xid->data);
|
||||
trx_sys_update_wsrep_checkpoint(xid, sys_header, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
return false;
|
||||
|
@ -851,8 +851,7 @@ trx_start_low(
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
memset(&trx->xid, 0, sizeof(trx->xid));
|
||||
trx->xid.formatID = -1;
|
||||
trx->xid.null();
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
/* The initial value for trx->no: TRX_ID_MAX is used in
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 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
|
||||
@ -95,17 +95,13 @@ dict_stats_pool_init()
|
||||
/*****************************************************************//**
|
||||
Free the resources occupied by the recalc pool, called once during
|
||||
thread de-initialization. */
|
||||
static
|
||||
void
|
||||
dict_stats_pool_deinit()
|
||||
/*===========================*/
|
||||
static void dict_stats_pool_deinit()
|
||||
{
|
||||
ut_ad(!srv_read_only_mode);
|
||||
|
||||
recalc_pool.clear();
|
||||
defrag_pool.clear();
|
||||
|
||||
/*
|
||||
/*
|
||||
recalc_pool may still have its buffer allocated. It will free it when
|
||||
its destructor is called.
|
||||
The problem is, memory leak detector is run before the recalc_pool's
|
||||
@ -115,9 +111,7 @@ dict_stats_pool_deinit()
|
||||
*/
|
||||
recalc_pool_t recalc_empty_pool;
|
||||
defrag_pool_t defrag_empty_pool;
|
||||
memset(&recalc_empty_pool, 0, sizeof(recalc_pool_t));
|
||||
memset(&defrag_empty_pool, 0, sizeof(defrag_pool_t));
|
||||
recalc_pool.swap(recalc_empty_pool);
|
||||
recalc_pool.swap(recalc_empty_pool);
|
||||
defrag_pool.swap(defrag_empty_pool);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 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
|
||||
@ -351,7 +351,7 @@ trx_sys_update_wsrep_checkpoint(
|
||||
mtr_t* mtr)
|
||||
{
|
||||
#ifdef UNIV_DEBUG
|
||||
if (xid->formatID != -1
|
||||
if (!xid->is_null()
|
||||
&& mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
|
||||
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD)
|
||||
== TRX_SYS_WSREP_XID_MAGIC_N) {
|
||||
@ -372,7 +372,7 @@ trx_sys_update_wsrep_checkpoint(
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
ut_ad(xid && mtr);
|
||||
ut_a(xid->formatID == -1 || wsrep_is_wsrep_xid((const XID *)xid));
|
||||
ut_a(xid->is_null() || wsrep_is_wsrep_xid((const XID *)xid));
|
||||
|
||||
if (mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
|
||||
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD)
|
||||
@ -421,8 +421,10 @@ trx_sys_read_wsrep_checkpoint(XID* xid)
|
||||
if ((magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
|
||||
+ TRX_SYS_WSREP_XID_MAGIC_N_FLD))
|
||||
!= TRX_SYS_WSREP_XID_MAGIC_N) {
|
||||
memset(xid, 0, sizeof(*xid));
|
||||
xid->formatID = -1;
|
||||
xid->null();
|
||||
xid->gtrid_length = 0;
|
||||
xid->bqual_length = 0;
|
||||
memset(xid->data, 0, sizeof xid->data);
|
||||
trx_sys_update_wsrep_checkpoint(xid, sys_header, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
return false;
|
||||
|
@ -1041,8 +1041,7 @@ trx_start_low(
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
memset(&trx->xid, 0, sizeof(trx->xid));
|
||||
trx->xid.formatID = -1;
|
||||
trx->xid.null();
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
/* The initial value for trx->no: TRX_ID_MAX is used in
|
||||
|
Loading…
x
Reference in New Issue
Block a user