]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Removed dead code to make static analyzer happier.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 9 Sep 2016 15:07:15 +0000 (18:07 +0300)
committerGitLab <gitlab@git.dovecot.net>
Tue, 13 Sep 2016 14:51:25 +0000 (17:51 +0300)
src/lib-dcrypt/dcrypt-openssl.c
src/lib-storage/index/dbox-common/dbox-save.c
src/lib-storage/list/mailbox-list-iter.c
src/lib-storage/mail-storage.c
src/plugins/fts-squat/squat-trie.c

index 7adec1f3819531d4c80d0689ebaf7259f5095f46..0402ca478be11473434a2aa143eee35bf785799c 100644 (file)
@@ -1075,7 +1075,7 @@ bool dcrypt_openssl_load_private_key_dovecot_v2(struct dcrypt_private_key **key_
                /* check that we have correct decryption key */
                dcrypt_openssl_private_to_public_key(dec_key, &pubkey);
                if (!dcrypt_openssl_public_key_id(pubkey, "sha256", data, error_r)) {
-                       if (pubkey != NULL) dcrypt_openssl_unref_public_key(&pubkey);
+                       dcrypt_openssl_unref_public_key(&pubkey);
                        return FALSE;
                }
 
index e808c2b493389d07fc6e248a759bd96cda4e336c..4a5e6b83f515ef3a0a29d8fd1d03d36033d5959e 100644 (file)
@@ -106,14 +106,10 @@ void dbox_save_end(struct dbox_save_context *ctx)
                ctx->failed = TRUE;
        }
        if (mdata->output != dbox_output) {
-               if (mdata->output != NULL) {
-                       /* e.g. zlib plugin had changed this */
-                       o_stream_ref(dbox_output);
-                       o_stream_destroy(&mdata->output);
-                       mdata->output = dbox_output;
-               } else {
-                       i_assert(ctx->failed);
-               }
+               /* e.g. zlib plugin had changed this */
+               o_stream_ref(dbox_output);
+               o_stream_destroy(&mdata->output);
+               mdata->output = dbox_output;
        }
        index_mail_cache_parse_deinit(ctx->ctx.dest_mail,
                                      ctx->ctx.data.received_date,
index 49974d78eba0d599c7d2aaaceeaa089d7c6a2c1c..2a7c4758eb7cabf44a946f24451bd4b6a12dec60 100644 (file)
@@ -164,21 +164,17 @@ mailbox_list_iter_init_multiple(struct mailbox_list *list,
                                enum mailbox_list_iter_flags flags)
 {
        struct mailbox_list_iterate_context *ctx;
-       int ret = 0;
 
        i_assert(*patterns != NULL);
 
        if ((flags & (MAILBOX_LIST_ITER_SELECT_SUBSCRIBED |
                      MAILBOX_LIST_ITER_RETURN_SUBSCRIBED)) != 0) {
-               ret = mailbox_list_iter_subscriptions_refresh(list);
-               if (ret < 0)
+               if (mailbox_list_iter_subscriptions_refresh(list) < 0)
                        return &mailbox_list_iter_failed;
        }
 
        ctx = list->v.iter_init(list, patterns, flags);
-       if (ret < 0)
-               ctx->failed = TRUE;
-       else if ((flags & MAILBOX_LIST_ITER_NO_AUTO_BOXES) == 0)
+       if ((flags & MAILBOX_LIST_ITER_NO_AUTO_BOXES) == 0)
                mailbox_list_iter_init_autocreate(ctx);
        return ctx;
 }
index 8bed1ae49c50f16a7e67a084c4f775aeaaf33671..f5098ebf98dc9a9797714db85a5896b0d8b8c880 100644 (file)
@@ -1004,7 +1004,7 @@ int mailbox_verify_create_name(struct mailbox *box)
                name++;
                old_name = name;
        }
-       if (old_name != NULL && strlen(old_name) > MAILBOX_MAX_HIERARCHY_NAME_LENGTH) {
+       if (strlen(old_name) > MAILBOX_MAX_HIERARCHY_NAME_LENGTH) {
                mail_storage_set_error(box->storage, MAIL_ERROR_PARAMS,
                                       "Mailbox name too long");
                return -1;
index 433ce1099d386e6b4f038e8e18a821e272c44acb..dfdafd5e0c48d574ca2554241449fe056f69622d 100644 (file)
@@ -2052,11 +2052,15 @@ squat_trie_lookup_real(struct squat_trie *trie, const char *str,
        } else {
                /* zero string length - list all root UIDs as definite
                   answers */
+#if 0 /* FIXME: this code is never actually reached now. */
                ret = squat_uidlist_get_seqrange(trie->uidlist,
                                                 trie->root.uid_list_idx,
                                                 &ctx.tmp_uids);
                squat_trie_filter_type(type, &ctx.tmp_uids,
                                       definite_uids);
+#else
+               i_unreached();
+#endif
        }
        seq_range_array_remove_seq_range(maybe_uids, definite_uids);
        squat_trie_add_unknown(trie, maybe_uids);