MDEV-9998 Fix issues caught by Clang's -Wpointer-bool-conversion warning

remove useless checks
and a couple of others
This commit is contained in:
Sergei Golubchik 2017-05-12 15:10:17 +02:00
parent f9264280d6
commit 71b4503242
14 changed files with 23 additions and 37 deletions

View File

@ -1405,7 +1405,7 @@ void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net)
DBUG_ASSERT(stmt != 0); DBUG_ASSERT(stmt != 0);
stmt->last_errno= net->last_errno; stmt->last_errno= net->last_errno;
if (net->last_error && net->last_error[0]) if (net->last_error[0])
strmov(stmt->last_error, net->last_error); strmov(stmt->last_error, net->last_error);
strmov(stmt->sqlstate, net->sqlstate); strmov(stmt->sqlstate, net->sqlstate);

View File

@ -1294,7 +1294,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,
/* fill in user_host value: the format is "%s[%s] @ %s [%s]" */ /* fill in user_host value: the format is "%s[%s] @ %s [%s]" */
user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE, user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE,
sctx->priv_user ? sctx->priv_user : "", "[", sctx->priv_user, "[",
sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ", sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ",
sctx->host ? sctx->host : "", " [", sctx->host ? sctx->host : "", " [",
sctx->ip ? sctx->ip : "", "]", NullS) - sctx->ip ? sctx->ip : "", "]", NullS) -

View File

@ -1681,8 +1681,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
default: default:
rli->report(ERROR_LEVEL, thd->net.last_errno, NULL, rli->report(ERROR_LEVEL, thd->net.last_errno, NULL,
"Error in %s event: row application failed. %s", "Error in %s event: row application failed. %s",
get_type_str(), get_type_str(), thd->net.last_error);
thd->net.last_error ? thd->net.last_error : "");
thd->is_slave_error= 1; thd->is_slave_error= 1;
break; break;
} }
@ -1721,8 +1720,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
"Error in %s event: error during transaction execution " "Error in %s event: error during transaction execution "
"on table %s.%s. %s", "on table %s.%s. %s",
get_type_str(), table->s->db.str, get_type_str(), table->s->db.str,
table->s->table_name.str, table->s->table_name.str, thd->net.last_error);
thd->net.last_error ? thd->net.last_error : "");
/* /*
If one day we honour --skip-slave-errors in row-based replication, and If one day we honour --skip-slave-errors in row-based replication, and

View File

@ -5647,8 +5647,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
TODO: handling `when' for SHOW SLAVE STATUS' snds behind TODO: handling `when' for SHOW SLAVE STATUS' snds behind
*/ */
if ((memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len()) if (memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len())
&& mi->master_log_name != NULL)
|| mi->master_log_pos > hb.log_pos) || mi->master_log_pos > hb.log_pos)
{ {
/* missed events of heartbeat from the past */ /* missed events of heartbeat from the past */
@ -6153,7 +6152,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir_ptr); mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir_ptr);
/* we disallow empty users */ /* we disallow empty users */
if (mi->user == NULL || mi->user[0] == 0) if (mi->user[0] == 0)
{ {
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL, mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
ER(ER_SLAVE_FATAL_ERROR), ER(ER_SLAVE_FATAL_ERROR),

View File

@ -10639,12 +10639,6 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
/* global privileges */ /* global privileges */
grant->privilege= sctx->master_access; grant->privilege= sctx->master_access;
if (!sctx->priv_user)
{
DBUG_PRINT("info", ("privilege 0x%lx", grant->privilege));
DBUG_VOID_RETURN; // it is slave
}
if (!thd->db || strcmp(db, thd->db)) if (!thd->db || strcmp(db, thd->db))
{ {
/* db privileges */ /* db privileges */

View File

@ -369,8 +369,7 @@ int initialize_audit_plugin(st_plugin_int *plugin)
{ {
st_mysql_audit *data= (st_mysql_audit*) plugin->plugin->info; st_mysql_audit *data= (st_mysql_audit*) plugin->plugin->info;
if (!data->class_mask || !data->event_notify || if (!data->event_notify || !data->class_mask[0])
!data->class_mask[0])
{ {
sql_print_error("Plugin '%s' has invalid data.", sql_print_error("Plugin '%s' has invalid data.",
plugin->name.str); plugin->name.str);

View File

@ -341,7 +341,7 @@ bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn, bool append)
bool ZIPUTIL::addEntry(PGLOBAL g, char *entry) bool ZIPUTIL::addEntry(PGLOBAL g, char *entry)
{ {
//?? we dont need the stinking time //?? we dont need the stinking time
zip_fileinfo zi = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; zip_fileinfo zi = { {0, 0, 0, 0, 0, 0}, 0, 0, 0 };
getTime(zi.tmz_date); getTime(zi.tmz_date);
target = entry; target = entry;

View File

@ -1192,7 +1192,7 @@ char *ha_connect::GetRealString(const char *s)
{ {
char *sv; char *sv;
if (IsPartitioned() && s && partname && *partname) { if (IsPartitioned() && s && *partname) {
sv= (char*)PlugSubAlloc(xp->g, NULL, 0); sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
sprintf(sv, s, partname); sprintf(sv, s, partname);
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1); PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);

View File

@ -7,7 +7,7 @@
/***********************************************************************/ /***********************************************************************/
#ifndef __TABEXT_H #ifndef __TABEXT_H
#define __TABEXTF_H #define __TABEXT_H
#include "reldef.h" #include "reldef.h"

View File

@ -6251,6 +6251,7 @@ dict_set_corrupted_index_cache_only(
dict_table_t* table) /*!< in/out: table */ dict_table_t* table) /*!< in/out: table */
{ {
ut_ad(index != NULL); ut_ad(index != NULL);
ut_ad(table != NULL);
ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(!dict_table_is_comp(dict_sys->sys_tables)); ut_ad(!dict_table_is_comp(dict_sys->sys_tables));
ut_ad(!dict_table_is_comp(dict_sys->sys_indexes)); ut_ad(!dict_table_is_comp(dict_sys->sys_indexes));
@ -6260,9 +6261,7 @@ dict_set_corrupted_index_cache_only(
if (dict_index_is_clust(index)) { if (dict_index_is_clust(index)) {
dict_table_t* corrupt_table; dict_table_t* corrupt_table;
corrupt_table = (table != NULL) ? table : index->table; corrupt_table = table;
ut_ad((index->table != NULL) || (table != NULL)
|| index->table == table);
if (corrupt_table) { if (corrupt_table) {
corrupt_table->corrupted = TRUE; corrupt_table->corrupted = TRUE;

View File

@ -2000,13 +2000,12 @@ innobase_get_stmt(
{ {
const char* query = NULL; const char* query = NULL;
LEX_STRING *stmt = NULL; LEX_STRING *stmt = NULL;
if (thd) { ut_ad(thd != NULL);
stmt = thd_query_string(thd); stmt = thd_query_string(thd);
if (stmt) { if (stmt) {
*length = stmt->length; *length = stmt->length;
query = stmt->str; query = stmt->str;
} }
}
return (query); return (query);
} }

View File

@ -911,7 +911,7 @@ bool sphinx_show_status ( THD * thd )
} }
// show last error or warning (either in addition to stats, or on their own) // show last error or warning (either in addition to stats, or on their own)
if ( pTls && pTls->m_pHeadTable && pTls->m_pHeadTable->m_tStats.m_sLastMessage && pTls->m_pHeadTable->m_tStats.m_sLastMessage[0] ) if ( pTls && pTls->m_pHeadTable && pTls->m_pHeadTable->m_tStats.m_sLastMessage[0] )
{ {
const char * sMessageType = pTls->m_pHeadTable->m_tStats.m_bLastError ? "error" : "warning"; const char * sMessageType = pTls->m_pHeadTable->m_tStats.m_bLastError ? "error" : "warning";

View File

@ -517,7 +517,6 @@ int spider_free_share_alloc(
) { ) {
int roop_count; int roop_count;
DBUG_ENTER("spider_free_share_alloc"); DBUG_ENTER("spider_free_share_alloc");
if (share->dbton_bitmap)
{ {
for (roop_count = SPIDER_DBTON_SIZE - 1; roop_count >= 0; roop_count--) for (roop_count = SPIDER_DBTON_SIZE - 1; roop_count >= 0; roop_count--)
{ {

View File

@ -2326,13 +2326,12 @@ innobase_get_stmt(
{ {
const char* query = NULL; const char* query = NULL;
LEX_STRING *stmt = NULL; LEX_STRING *stmt = NULL;
if (thd) { ut_ad(thd != NULL);
stmt = thd_query_string(thd); stmt = thd_query_string(thd);
if (stmt) { if (stmt) {
*length = stmt->length; *length = stmt->length;
query = stmt->str; query = stmt->str;
} }
}
return (query); return (query);
} }