]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Fix dead assignments in expressions.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 6 Oct 2020 22:06:08 +0000 (00:06 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Thu, 15 Oct 2020 16:12:16 +0000 (16:12 +0000)
Found by Clang scan-build.

src/auth/db-lua.c
src/lib-sql/driver-cassandra.c
src/lib/ostream-wrapper.c
src/plugins/mail-lua/mail-lua-plugin.c
src/plugins/mail-lua/mail-storage-lua.c
src/plugins/push-notification/push-notification-driver-lua.c

index 987332867effed6a91ccd90f939473dbdf7e910f..2ce28884a1c66e0df4ffe5153fd831615b060c82 100644 (file)
@@ -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));
index 74540b0e0bb8532003e03ddaeea54fc18071adf4..8b30f130e135a53f9f579bd4dfacfa5cae90cbd2 100644 (file)
@@ -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");
index e2e5fd1a30c821a7639b410f346e7758f266ff6a..882e25fcb4929a9f8952056a9cef1af087143c20 100644 (file)
@@ -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)) {
index d49adf7b5870cc58d2a5776dcf820cd66f7e9127..c58c098ea11d8c26403a63bc0700fe0073d3e3eb 100644 (file)
@@ -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);
        }
 
index b892cfd2dc26bc9c16916f9f3736db3d93b1953d..2adda0a962047b0555d0f7e2f897cde104ce679a 100644 (file)
@@ -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);
index 09eab7b4925ec0d3b133d27eaeac6ae636a53e6a..0d78534aba20ad7286fe94185f011298c2ead910 100644 (file)
@@ -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);