Skip to content
Permalink
Browse files

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

remove useless checks
and a couple of others
  • Loading branch information...
vuvova committed May 12, 2017
1 parent f926428 commit 71b45032421fe47fceabe419c63e79c44794428d
@@ -1405,7 +1405,7 @@ void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net)
DBUG_ASSERT(stmt != 0);

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->sqlstate, net->sqlstate);

@@ -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]" */
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->host ? sctx->host : "", " [",
sctx->ip ? sctx->ip : "", "]", NullS) -
@@ -1681,8 +1681,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
default:
rli->report(ERROR_LEVEL, thd->net.last_errno, NULL,
"Error in %s event: row application failed. %s",
get_type_str(),
thd->net.last_error ? thd->net.last_error : "");
get_type_str(), thd->net.last_error);
thd->is_slave_error= 1;
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 "
"on table %s.%s. %s",
get_type_str(), table->s->db.str,
table->s->table_name.str,
thd->net.last_error ? thd->net.last_error : "");
table->s->table_name.str, thd->net.last_error);

/*
If one day we honour --skip-slave-errors in row-based replication, and
@@ -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
*/
if ((memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len())
&& mi->master_log_name != NULL)
if (memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len())
|| mi->master_log_pos > hb.log_pos)
{
/* 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);

/* 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,
ER(ER_SLAVE_FATAL_ERROR),
@@ -10639,12 +10639,6 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
/* global privileges */
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))
{
/* db privileges */
@@ -369,8 +369,7 @@ int initialize_audit_plugin(st_plugin_int *plugin)
{
st_mysql_audit *data= (st_mysql_audit*) plugin->plugin->info;

if (!data->class_mask || !data->event_notify ||
!data->class_mask[0])
if (!data->event_notify || !data->class_mask[0])
{
sql_print_error("Plugin '%s' has invalid data.",
plugin->name.str);
@@ -341,7 +341,7 @@ bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn, bool append)
bool ZIPUTIL::addEntry(PGLOBAL g, char *entry)
{
//?? 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);
target = entry;
@@ -1192,7 +1192,7 @@ char *ha_connect::GetRealString(const char *s)
{
char *sv;

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

#ifndef __TABEXT_H
#define __TABEXTF_H
#define __TABEXT_H

#include "reldef.h"

@@ -6251,6 +6251,7 @@ dict_set_corrupted_index_cache_only(
dict_table_t* table) /*!< in/out: table */
{
ut_ad(index != NULL);
ut_ad(table != NULL);
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_indexes));
@@ -6260,9 +6261,7 @@ dict_set_corrupted_index_cache_only(
if (dict_index_is_clust(index)) {
dict_table_t* corrupt_table;

corrupt_table = (table != NULL) ? table : index->table;
ut_ad((index->table != NULL) || (table != NULL)
|| index->table == table);
corrupt_table = table;

if (corrupt_table) {
corrupt_table->corrupted = TRUE;
@@ -2000,12 +2000,11 @@ innobase_get_stmt(
{
const char* query = NULL;
LEX_STRING *stmt = NULL;
if (thd) {
stmt = thd_query_string(thd);
if (stmt) {
*length = stmt->length;
query = stmt->str;
}
ut_ad(thd != NULL);
stmt = thd_query_string(thd);
if (stmt) {
*length = stmt->length;
query = stmt->str;
}
return (query);
}
@@ -911,7 +911,7 @@ bool sphinx_show_status ( THD * thd )
}

// 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";

@@ -517,7 +517,6 @@ int spider_free_share_alloc(
) {
int roop_count;
DBUG_ENTER("spider_free_share_alloc");
if (share->dbton_bitmap)
{
for (roop_count = SPIDER_DBTON_SIZE - 1; roop_count >= 0; roop_count--)
{
@@ -2326,12 +2326,11 @@ innobase_get_stmt(
{
const char* query = NULL;
LEX_STRING *stmt = NULL;
if (thd) {
stmt = thd_query_string(thd);
if (stmt) {
*length = stmt->length;
query = stmt->str;
}
ut_ad(thd != NULL);
stmt = thd_query_string(thd);
if (stmt) {
*length = stmt->length;
query = stmt->str;
}
return (query);
}

0 comments on commit 71b4503

Please sign in to comment.
You can’t perform that action at this time.