Skip to content

Commit 71b4503

Browse files
committed
MDEV-9998 Fix issues caught by Clang's -Wpointer-bool-conversion warning
remove useless checks and a couple of others
1 parent f926428 commit 71b4503

File tree

14 files changed

+23
-37
lines changed

14 files changed

+23
-37
lines changed

libmysql/libmysql.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net)
14051405
DBUG_ASSERT(stmt != 0);
14061406

14071407
stmt->last_errno= net->last_errno;
1408-
if (net->last_error && net->last_error[0])
1408+
if (net->last_error[0])
14091409
strmov(stmt->last_error, net->last_error);
14101410
strmov(stmt->sqlstate, net->sqlstate);
14111411

sql/log.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,
12941294

12951295
/* fill in user_host value: the format is "%s[%s] @ %s [%s]" */
12961296
user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE,
1297-
sctx->priv_user ? sctx->priv_user : "", "[",
1297+
sctx->priv_user, "[",
12981298
sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ",
12991299
sctx->host ? sctx->host : "", " [",
13001300
sctx->ip ? sctx->ip : "", "]", NullS) -

sql/log_event_old.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,8 +1681,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
16811681
default:
16821682
rli->report(ERROR_LEVEL, thd->net.last_errno, NULL,
16831683
"Error in %s event: row application failed. %s",
1684-
get_type_str(),
1685-
thd->net.last_error ? thd->net.last_error : "");
1684+
get_type_str(), thd->net.last_error);
16861685
thd->is_slave_error= 1;
16871686
break;
16881687
}
@@ -1721,8 +1720,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
17211720
"Error in %s event: error during transaction execution "
17221721
"on table %s.%s. %s",
17231722
get_type_str(), table->s->db.str,
1724-
table->s->table_name.str,
1725-
thd->net.last_error ? thd->net.last_error : "");
1723+
table->s->table_name.str, thd->net.last_error);
17261724

17271725
/*
17281726
If one day we honour --skip-slave-errors in row-based replication, and

sql/slave.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5647,8 +5647,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
56475647
56485648
TODO: handling `when' for SHOW SLAVE STATUS' snds behind
56495649
*/
5650-
if ((memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len())
5651-
&& mi->master_log_name != NULL)
5650+
if (memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len())
56525651
|| mi->master_log_pos > hb.log_pos)
56535652
{
56545653
/* missed events of heartbeat from the past */
@@ -6153,7 +6152,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
61536152
mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir_ptr);
61546153

61556154
/* we disallow empty users */
6156-
if (mi->user == NULL || mi->user[0] == 0)
6155+
if (mi->user[0] == 0)
61576156
{
61586157
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
61596158
ER(ER_SLAVE_FATAL_ERROR),

sql/sql_acl.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10639,12 +10639,6 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
1063910639
/* global privileges */
1064010640
grant->privilege= sctx->master_access;
1064110641

10642-
if (!sctx->priv_user)
10643-
{
10644-
DBUG_PRINT("info", ("privilege 0x%lx", grant->privilege));
10645-
DBUG_VOID_RETURN; // it is slave
10646-
}
10647-
1064810642
if (!thd->db || strcmp(db, thd->db))
1064910643
{
1065010644
/* db privileges */

sql/sql_audit.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@ int initialize_audit_plugin(st_plugin_int *plugin)
369369
{
370370
st_mysql_audit *data= (st_mysql_audit*) plugin->plugin->info;
371371

372-
if (!data->class_mask || !data->event_notify ||
373-
!data->class_mask[0])
372+
if (!data->event_notify || !data->class_mask[0])
374373
{
375374
sql_print_error("Plugin '%s' has invalid data.",
376375
plugin->name.str);

storage/connect/filamzip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn, bool append)
341341
bool ZIPUTIL::addEntry(PGLOBAL g, char *entry)
342342
{
343343
//?? we dont need the stinking time
344-
zip_fileinfo zi = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
344+
zip_fileinfo zi = { {0, 0, 0, 0, 0, 0}, 0, 0, 0 };
345345

346346
getTime(zi.tmz_date);
347347
target = entry;

storage/connect/ha_connect.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ char *ha_connect::GetRealString(const char *s)
11921192
{
11931193
char *sv;
11941194

1195-
if (IsPartitioned() && s && partname && *partname) {
1195+
if (IsPartitioned() && s && *partname) {
11961196
sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
11971197
sprintf(sv, s, partname);
11981198
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);

storage/connect/tabext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/***********************************************************************/
88

99
#ifndef __TABEXT_H
10-
#define __TABEXTF_H
10+
#define __TABEXT_H
1111

1212
#include "reldef.h"
1313

storage/innobase/dict/dict0dict.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6251,6 +6251,7 @@ dict_set_corrupted_index_cache_only(
62516251
dict_table_t* table)/*!< in/out: table */
62526252
{
62536253
ut_ad(index != NULL);
6254+
ut_ad(table != NULL);
62546255
ut_ad(mutex_own(&dict_sys->mutex));
62556256
ut_ad(!dict_table_is_comp(dict_sys->sys_tables));
62566257
ut_ad(!dict_table_is_comp(dict_sys->sys_indexes));
@@ -6260,9 +6261,7 @@ dict_set_corrupted_index_cache_only(
62606261
if (dict_index_is_clust(index)) {
62616262
dict_table_t* corrupt_table;
62626263

6263-
corrupt_table = (table != NULL) ? table : index->table;
6264-
ut_ad((index->table != NULL) || (table != NULL)
6265-
|| index->table == table);
6264+
corrupt_table = table;
62666265

62676266
if (corrupt_table) {
62686267
corrupt_table->corrupted = TRUE;

0 commit comments

Comments
 (0)