From: Stephan Bosch Date: Tue, 6 Oct 2020 22:06:08 +0000 (+0200) Subject: global: Fix dead assignments in expressions. X-Git-Tag: 2.3.13~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=904d96418a4fcda8e6c33f9c0cb353f3ba1d65fa;p=thirdparty%2Fdovecot%2Fcore.git global: Fix dead assignments in expressions. Found by Clang scan-build. --- diff --git a/src/auth/db-lua.c b/src/auth/db-lua.c index 987332867e..2ce28884a1 100644 --- a/src/auth/db-lua.c +++ b/src/auth/db-lua.c @@ -708,7 +708,6 @@ auth_lua_call_userdb_iterate_init(struct dlua_script *script, struct auth_reques pool_t pool = pool_alloconly_create(MEMPOOL_GROWING"lua userdb iterate", 128); struct auth_lua_userdb_iterate_context *actx = p_new(pool, struct auth_lua_userdb_iterate_context, 1); - int ret; actx->pool = pool; actx->ctx.auth_request = req; @@ -723,7 +722,7 @@ auth_lua_call_userdb_iterate_init(struct dlua_script *script, struct auth_reques e_debug(authdb_event(req), "Calling %s", AUTH_LUA_USERDB_ITERATE); - if ((ret = lua_pcall(script->L, 0, 1, 0)) != 0) { + if (lua_pcall(script->L, 0, 1, 0) != 0) { e_error(authdb_event(req), "db-lua: " AUTH_LUA_USERDB_ITERATE " failed: %s", lua_tostring(script->L, -1)); diff --git a/src/lib-sql/driver-cassandra.c b/src/lib-sql/driver-cassandra.c index 74540b0e0b..8b30f130e1 100644 --- a/src/lib-sql/driver-cassandra.c +++ b/src/lib-sql/driver-cassandra.c @@ -513,9 +513,8 @@ driver_cassandra_set_callback(CassFuture *future, struct cassandra_db *db, static void connect_callback(CassFuture *future, void *context) { struct cassandra_db *db = context; - CassError rc; - if ((rc = cass_future_error_code(future)) != CASS_OK) { + if (cass_future_error_code(future) != CASS_OK) { driver_cassandra_log_error(db, future, "Couldn't connect to Cassandra"); driver_cassandra_close(db, "Couldn't connect to Cassandra"); diff --git a/src/lib/ostream-wrapper.c b/src/lib/ostream-wrapper.c index e2e5fd1a30..882e25fcb4 100644 --- a/src/lib/ostream-wrapper.c +++ b/src/lib/ostream-wrapper.c @@ -647,7 +647,7 @@ wrapper_ostream_sendv_real(struct wrapper_ostream *wostream, if (!wrapper_ostream_is_empty(wostream) && (!stream->corked || wrapper_ostream_is_filled(wostream)) && wrapper_ostream_send_prepare(wostream, size) && - (ret = wrapper_ostream_flush_buffer(wostream)) < 0) + wrapper_ostream_flush_buffer(wostream) < 0) return -1; if (!stream->corked && wrapper_ostream_is_full(wostream)) { diff --git a/src/plugins/mail-lua/mail-lua-plugin.c b/src/plugins/mail-lua/mail-lua-plugin.c index d49adf7b58..c58c098ea1 100644 --- a/src/plugins/mail-lua/mail-lua-plugin.c +++ b/src/plugins/mail-lua/mail-lua-plugin.c @@ -62,13 +62,12 @@ static void mail_lua_user_deinit_pre(struct mail_user *user) { struct mail_lua_user_context *luser = MAIL_LUA_USER_CONTEXT(user); const char *error; - int ret; if (luser == NULL) return; - if ((ret = mail_lua_call_hook(luser->script, user, MAIL_LUA_USER_DEINIT_PRE_FN, - &error)) < 0) { + if (mail_lua_call_hook(luser->script, user, MAIL_LUA_USER_DEINIT_PRE_FN, + &error) < 0) { e_error(user->event, "mail-lua: %s", error); } @@ -79,15 +78,14 @@ static void mail_lua_user_deinit(struct mail_user *user) { struct mail_lua_user_context *luser = MAIL_LUA_USER_CONTEXT(user); const char *error; - int ret; if (luser == NULL) return; luser->module_ctx.super.deinit(user); - if ((ret = mail_lua_call_hook(luser->script, user, MAIL_LUA_USER_DEINIT_FN, - &error)) < 0) { + if (mail_lua_call_hook(luser->script, user, MAIL_LUA_USER_DEINIT_FN, + &error) < 0) { e_error(user->event, "mail-lua: %s", error); } diff --git a/src/plugins/mail-lua/mail-storage-lua.c b/src/plugins/mail-lua/mail-storage-lua.c index b892cfd2dc..2adda0a962 100644 --- a/src/plugins/mail-lua/mail-storage-lua.c +++ b/src/plugins/mail-lua/mail-storage-lua.c @@ -433,7 +433,6 @@ lua_storage_mail_user_set_metadata_unset(struct dlua_script *script, size_t value_len) { const char *error; - int ret; /* reformat key */ if ((key = lua_storage_mail_user_metadata_key(key)) == NULL) { @@ -452,8 +451,8 @@ lua_storage_mail_user_set_metadata_unset(struct dlua_script *script, "Cannot open INBOX: %s", error); } - if ((ret = lua_storage_mailbox_attribute_set(mbox, key, value, - value_len, &error)) < 0) { + if (lua_storage_mailbox_attribute_set(mbox, key, value, value_len, + &error) < 0) { mailbox_free(&mbox); return luaL_error(script->L, "Cannot get attribute: %s", error); diff --git a/src/plugins/push-notification/push-notification-driver-lua.c b/src/plugins/push-notification/push-notification-driver-lua.c index 09eab7b492..0d78534aba 100644 --- a/src/plugins/push-notification/push-notification-driver-lua.c +++ b/src/plugins/push-notification/push-notification-driver-lua.c @@ -188,8 +188,6 @@ push_notification_driver_lua_begin_txn( event_set_name(event, DLUA_CALL_FINISHED); event_add_str(event, "function_name", DLUA_FN_BEGIN_TXN); - int luaerr; - /* Start txn and store whatever LUA gives us back, it's our txid */ lua_getglobal(ctx->script->L, DLUA_FN_BEGIN_TXN); if (!lua_isfunction(ctx->script->L, -1)) { @@ -211,7 +209,7 @@ push_notification_driver_lua_begin_txn( /* Push mail user as argument */ dlua_push_mail_user(ctx->script, user); - if ((luaerr = lua_pcall(ctx->script->L, 1, 1, 0)) != 0) { + if (lua_pcall(ctx->script->L, 1, 1, 0) != 0) { const char *error = lua_tostring(ctx->script->L, -1); event_add_str(event, "error", error); e_error(event, "%s", error); @@ -505,7 +503,6 @@ push_notification_driver_lua_call( const struct push_notification_txn_mbox *mbox, struct push_notification_txn_msg *msg) { - int luaerr; const char *fn = push_notification_driver_lua_to_fn(event->event->event->name); struct event *e = event_create(ctx->event); @@ -546,7 +543,7 @@ push_notification_driver_lua_call( i_unreached(); /* Perform call */ - if ((luaerr = lua_pcall(ctx->script->L, 2, 0, 0)) != 0) { + if (lua_pcall(ctx->script->L, 2, 0, 0) != 0) { const char *error = lua_tostring(ctx->script->L, -1); event_add_str(e, "error", error); e_error(e, "%s", error);