changeset 20734:1e3fc9741860

Removed dead code to make static analyzer happier.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Fri, 09 Sep 2016 18:07:15 +0300
parents 58c584d6cc4a
children ad61b4f88130
files 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
diffstat 5 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-dcrypt/dcrypt-openssl.c	Fri Sep 09 17:55:20 2016 +0300
+++ b/src/lib-dcrypt/dcrypt-openssl.c	Fri Sep 09 18:07:15 2016 +0300
@@ -1075,7 +1075,7 @@
 		/* 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;
 		}
 
--- a/src/lib-storage/index/dbox-common/dbox-save.c	Fri Sep 09 17:55:20 2016 +0300
+++ b/src/lib-storage/index/dbox-common/dbox-save.c	Fri Sep 09 18:07:15 2016 +0300
@@ -115,14 +115,10 @@
 		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,
--- a/src/lib-storage/list/mailbox-list-iter.c	Fri Sep 09 17:55:20 2016 +0300
+++ b/src/lib-storage/list/mailbox-list-iter.c	Fri Sep 09 18:07:15 2016 +0300
@@ -164,21 +164,17 @@
 				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;
 }
--- a/src/lib-storage/mail-storage.c	Fri Sep 09 17:55:20 2016 +0300
+++ b/src/lib-storage/mail-storage.c	Fri Sep 09 18:07:15 2016 +0300
@@ -1004,7 +1004,7 @@
 		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;
--- a/src/plugins/fts-squat/squat-trie.c	Fri Sep 09 17:55:20 2016 +0300
+++ b/src/plugins/fts-squat/squat-trie.c	Fri Sep 09 18:07:15 2016 +0300
@@ -2052,11 +2052,15 @@
 	} 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);