]> 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)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 15 Sep 2016 05:58:14 +0000 (08:58 +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 5e11a2182773e0b026f548a3f5e6ccf614ba6618..fb8ad39fa72ccac58e2d7fef3dbb5cbf6a420f83 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 456cfe339c914d6c748a736f70a3e62fd0a1a606..0d82f4ded771b55d980c2b727b95c81fd8c9be4e 100644 (file)
@@ -115,14 +115,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 d2760a7a7fe9c9cb93b2619ece313928c5cdd7e4..3702532303e0cc18707c79ae2d1a1bd538fb7b36 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 086226225fb07c7d55ba80c6db2ef31064a147d6..94f49414806c29d67a569860cd6c2096b7d82722 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);