From: Timo Sirainen Date: Sun, 4 Apr 2010 22:06:02 +0000 (+0300) Subject: Removed dead code. X-Git-Tag: 2.0.beta5~235 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8bb360f9e5de1c25e4f875205bb06e8bf15dae14;p=thirdparty%2Fdovecot%2Fcore.git Removed dead code. --HG-- branch : HEAD --- diff --git a/src/auth/auth-master-connection.c b/src/auth/auth-master-connection.c index 84f7887431..b70dd871c4 100644 --- a/src/auth/auth-master-connection.c +++ b/src/auth/auth-master-connection.c @@ -464,9 +464,7 @@ static void master_input(struct auth_master_connection *conn) static int master_output(struct auth_master_connection *conn) { - int ret; - - if ((ret = o_stream_flush(conn->output)) < 0) { + if (o_stream_flush(conn->output) < 0) { /* transmit error, probably master died */ auth_master_connection_destroy(&conn); return 1; diff --git a/src/auth/auth-request-handler.c b/src/auth/auth-request-handler.c index 2b815cf4f1..9f0a580ab6 100644 --- a/src/auth/auth-request-handler.c +++ b/src/auth/auth-request-handler.c @@ -103,7 +103,7 @@ static void get_client_extra_fields(struct auth_request *request, struct auth_stream_reply *reply) { const char **fields, *extra_fields; - unsigned int src, dest; + unsigned int src; bool seen_pass = FALSE; if (auth_stream_is_empty(request->extra_fields)) @@ -120,7 +120,7 @@ static void get_client_extra_fields(struct auth_request *request, } fields = t_strsplit(extra_fields, "\t"); - for (src = dest = 0; fields[src] != NULL; src++) { + for (src = 0; fields[src] != NULL; src++) { if (strncmp(fields[src], "userdb_", 7) != 0) { if (!seen_pass && strncmp(fields[src], "pass=", 5) == 0) seen_pass = TRUE; diff --git a/src/config/old-set-parser.c b/src/config/old-set-parser.c index 224703b6a8..5b355a9e7c 100644 --- a/src/config/old-set-parser.c +++ b/src/config/old-set-parser.c @@ -202,9 +202,9 @@ config_apply_auth_set(struct config_parser_context *ctx, static bool listen_has_port(const char *str) { - const char *p, *const *addrs; + const char *const *addrs; - if ((p = strchr(str, ':')) == NULL) + if (strchr(str, ':') == NULL) return FALSE; addrs = t_strsplit_spaces(str, ", "); diff --git a/src/dict/dict-commands.c b/src/dict/dict-commands.c index 202fa7015e..f2ad2f16e3 100644 --- a/src/dict/dict-commands.c +++ b/src/dict/dict-commands.c @@ -48,7 +48,6 @@ static int cmd_iterate_flush(struct dict_connection *conn) { string_t *str; const char *key, *value; - int ret; str = t_str_new(256); o_stream_cork(conn->output); @@ -73,7 +72,7 @@ static int cmd_iterate_flush(struct dict_connection *conn) o_stream_unset_flush_callback(conn->output); str_truncate(str, 0); - if ((ret = dict_iterate_deinit(&conn->iter_ctx)) < 0) + if (dict_iterate_deinit(&conn->iter_ctx) < 0) str_append_c(str, DICT_PROTOCOL_REPLY_FAIL); str_append_c(str, '\n'); o_stream_send(conn->output, str_data(str), str_len(str)); diff --git a/src/doveadm/doveadm-dump-log.c b/src/doveadm/doveadm-dump-log.c index 6f02a90abf..9b7e656759 100644 --- a/src/doveadm/doveadm-dump-log.c +++ b/src/doveadm/doveadm-dump-log.c @@ -397,7 +397,7 @@ static void log_record_print(const struct mail_transaction_header *hdr, break; } case MAIL_TRANSACTION_UID_UPDATE: { - const struct mail_transaction_uid_update *rec = data, *end; + const struct mail_transaction_uid_update *rec, *end; end = CONST_PTR_OFFSET(data, size); for (rec = data; rec < end; rec++) { @@ -407,7 +407,7 @@ static void log_record_print(const struct mail_transaction_header *hdr, break; } case MAIL_TRANSACTION_MODSEQ_UPDATE: { - const struct mail_transaction_modseq_update *rec = data, *end; + const struct mail_transaction_modseq_update *rec, *end; end = CONST_PTR_OFFSET(data, size); for (rec = data; rec < end; rec++) { diff --git a/src/imap/cmd-close.c b/src/imap/cmd-close.c index 461145703f..b32f682457 100644 --- a/src/imap/cmd-close.c +++ b/src/imap/cmd-close.c @@ -9,7 +9,6 @@ bool cmd_close(struct client_command_context *cmd) struct client *client = cmd->client; struct mailbox *mailbox = client->mailbox; struct mail_storage *storage; - int ret; if (!client_verify_open_mailbox(cmd)) return TRUE; @@ -18,7 +17,7 @@ bool cmd_close(struct client_command_context *cmd) client->mailbox = NULL; storage = mailbox_get_storage(mailbox); - if ((ret = imap_expunge(mailbox, NULL)) < 0) + if (imap_expunge(mailbox, NULL) < 0) client_send_untagged_storage_error(client, storage); if (mailbox_sync(mailbox, 0) < 0) client_send_untagged_storage_error(client, storage); diff --git a/src/imap/cmd-list.c b/src/imap/cmd-list.c index df4bcbf518..39ef8c023c 100644 --- a/src/imap/cmd-list.c +++ b/src/imap/cmd-list.c @@ -358,12 +358,11 @@ list_namespace_mailboxes(struct cmd_list_context *ctx) const struct mailbox_info *info; struct mail_namespace *ns; enum mailbox_info_flags flags; - string_t *str, *name_str; + string_t *str; const char *name; int ret = 0; str = t_str_new(256); - name_str = t_str_new(256); while ((info = mailbox_list_iter_next(ctx->list_iter)) != NULL) { name = info->name; flags = info->flags; diff --git a/src/imap/cmd-select.c b/src/imap/cmd-select.c index 039cd69470..ae630d6502 100644 --- a/src/imap/cmd-select.c +++ b/src/imap/cmd-select.c @@ -30,13 +30,12 @@ static int select_qresync_get_uids(struct imap_select_context *ctx, const ARRAY_TYPE(seq_range) *seqset, const ARRAY_TYPE(seq_range) *uidset) { - const struct seq_range *seq_range, *uid_range; + const struct seq_range *uid_range; struct seq_range_iter seq_iter; - unsigned int i, seq_count, uid_count, diff, n = 0; + unsigned int i, uid_count, diff, n = 0; uint32_t seq; /* change all n:m ranges to n,m and store the results */ - seq_range = array_get(seqset, &seq_count); uid_range = array_get(uidset, &uid_count); seq_range_array_iter_init(&seq_iter, seqset); @@ -200,9 +199,8 @@ static void cmd_select_finish(struct imap_select_context *ctx, int ret) static bool cmd_select_continue(struct client_command_context *cmd) { struct imap_select_context *ctx = cmd->context; - int ret; - if ((ret = imap_fetch_more(ctx->fetch_ctx)) == 0) { + if (imap_fetch_more(ctx->fetch_ctx) == 0) { /* unfinished */ return FALSE; } diff --git a/src/imap/cmd-sort.c b/src/imap/cmd-sort.c index cb6f89cadd..af77dcdbb9 100644 --- a/src/imap/cmd-sort.c +++ b/src/imap/cmd-sort.c @@ -78,7 +78,7 @@ get_sort_program(struct client_command_context *cmd, client_send_command_error(cmd, "Sort list ends with REVERSE."); return -1; } - program[pos++] = MAIL_SORT_END; + program[pos] = MAIL_SORT_END; if (args->type != IMAP_ARG_EOL) { client_send_command_error(cmd, diff --git a/src/imap/cmd-unselect.c b/src/imap/cmd-unselect.c index 5110a10418..73523b5bd9 100644 --- a/src/imap/cmd-unselect.c +++ b/src/imap/cmd-unselect.c @@ -7,7 +7,6 @@ bool cmd_unselect(struct client_command_context *cmd) { struct client *client = cmd->client; struct mailbox *mailbox = client->mailbox; - struct mail_storage *storage; if (!client_verify_open_mailbox(cmd)) return TRUE; @@ -17,7 +16,6 @@ bool cmd_unselect(struct client_command_context *cmd) i_assert(client->mailbox_change_lock == NULL); client->mailbox = NULL; - storage = mailbox_get_storage(mailbox); mailbox_free(&mailbox); client_update_mailbox_flags(client, NULL); diff --git a/src/lda/main.c b/src/lda/main.c index 8a0743799a..28378439ee 100644 --- a/src/lda/main.c +++ b/src/lda/main.c @@ -167,7 +167,7 @@ create_raw_stream(struct mail_deliver_context *ctx, if (ret > 0 && size >= 5 && memcmp(data, "From ", 5) == 0) { /* skip until the first LF */ i_stream_skip(input, 5); - while ((ret = i_stream_read_data(input, &data, &size, 0)) > 0) { + while (i_stream_read_data(input, &data, &size, 0) > 0) { for (i = 0; i < size; i++) { if (data[i] == '\n') break; diff --git a/src/lib-imap/imap-match.c b/src/lib-imap/imap-match.c index 6b598fb9cd..95b7d541ef 100644 --- a/src/lib-imap/imap-match.c +++ b/src/lib-imap/imap-match.c @@ -69,7 +69,7 @@ static const char *pattern_compress(const char *pattern) *dest++ = *pattern++; } } - *dest++ = '\0'; + *dest = '\0'; return ret; } diff --git a/src/lib-index/mail-cache-transaction.c b/src/lib-index/mail-cache-transaction.c index 57b5e00ef3..4ede709ab1 100644 --- a/src/lib-index/mail-cache-transaction.c +++ b/src/lib-index/mail-cache-transaction.c @@ -884,7 +884,7 @@ static int mail_cache_header_add_field(struct mail_cache_transaction_ctx *ctx, struct mail_cache *cache = ctx->cache; int ret; - if ((ret = mail_cache_transaction_lock(ctx)) <= 0) { + if (mail_cache_transaction_lock(ctx) <= 0) { if (MAIL_CACHE_IS_UNUSABLE(cache)) return -1; @@ -895,7 +895,7 @@ static int mail_cache_header_add_field(struct mail_cache_transaction_ctx *ctx, return 0; /* need to add it */ - if ((ret = mail_cache_transaction_lock(ctx)) <= 0) + if (mail_cache_transaction_lock(ctx) <= 0) return -1; } diff --git a/src/lib-index/mail-index-sync-ext.c b/src/lib-index/mail-index-sync-ext.c index d17bf9965f..0c8294c349 100644 --- a/src/lib-index/mail-index-sync-ext.c +++ b/src/lib-index/mail-index-sync-ext.c @@ -338,7 +338,7 @@ sync_ext_resize(const struct mail_transaction_ext_intro *u, sync_ext_reorder(map, ext_map_idx, old_record_size); } else if (modified) { /* header size changed. recreate index file. */ - map = mail_index_sync_get_atomic_map(ctx); + (void)mail_index_sync_get_atomic_map(ctx); } } @@ -372,7 +372,7 @@ mail_index_sync_ext_init_new(struct mail_index_sync_map_ctx *ctx, const struct mail_index_ext_header *ext_hdr, uint32_t *ext_map_idx_r) { - struct mail_index_map *map = ctx->view->map; + struct mail_index_map *map; const struct mail_index_ext *ext; buffer_t *hdr_buf; uint32_t ext_map_idx; @@ -573,7 +573,7 @@ static void mail_index_sync_ext_clear(struct mail_index_view *view, int mail_index_sync_ext_reset(struct mail_index_sync_map_ctx *ctx, const struct mail_transaction_ext_reset *u) { - struct mail_index_map *map = ctx->view->map; + struct mail_index_map *map; struct mail_index_ext_header *ext_hdr; struct mail_index_ext *ext; diff --git a/src/lib-index/mail-index-sync-update.c b/src/lib-index/mail-index-sync-update.c index 8efaef7da9..c861df6b93 100644 --- a/src/lib-index/mail-index-sync-update.c +++ b/src/lib-index/mail-index-sync-update.c @@ -237,7 +237,7 @@ sync_expunge_call_handlers(struct mail_index_sync_map_ctx *ctx, static void sync_expunge(struct mail_index_sync_map_ctx *ctx, uint32_t uid1, uint32_t uid2) { - struct mail_index_map *map = ctx->view->map; + struct mail_index_map *map; struct mail_index_record *rec; uint32_t seq_count, seq, seq1, seq2; @@ -673,7 +673,7 @@ int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx, break; } case MAIL_TRANSACTION_EXT_HDR_UPDATE: { - const struct mail_transaction_ext_hdr_update *rec = data; + const struct mail_transaction_ext_hdr_update *rec; unsigned int i; for (i = 0; i < hdr->size; ) { @@ -699,7 +699,7 @@ int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx, break; } case MAIL_TRANSACTION_EXT_HDR_UPDATE32: { - const struct mail_transaction_ext_hdr_update32 *rec = data; + const struct mail_transaction_ext_hdr_update32 *rec; unsigned int i; for (i = 0; i < hdr->size; ) { @@ -779,7 +779,6 @@ int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx, break; } - rec = data; end = CONST_PTR_OFFSET(data, hdr->size); for (rec = data; rec < end; rec++) { ret = mail_index_sync_ext_atomic_inc(ctx, rec); @@ -801,7 +800,7 @@ int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx, break; } case MAIL_TRANSACTION_UID_UPDATE: { - const struct mail_transaction_uid_update *rec = data, *end; + const struct mail_transaction_uid_update *rec, *end; end = CONST_PTR_OFFSET(data, hdr->size); for (rec = data; rec < end; rec++) diff --git a/src/lib-index/mail-index-view-sync.c b/src/lib-index/mail-index-view-sync.c index 8b98767b0d..40620f03cb 100644 --- a/src/lib-index/mail-index-view-sync.c +++ b/src/lib-index/mail-index-view-sync.c @@ -511,7 +511,7 @@ mail_index_view_sync_begin(struct mail_index_view *view, enum mail_index_view_sync_flags flags) { struct mail_index_view_sync_ctx *ctx; - struct mail_index_map *map; + struct mail_index_map *tmp_map; unsigned int expunge_count = 0; bool reset, sync_expunges, have_expunges; int ret; @@ -613,11 +613,9 @@ mail_index_view_sync_begin(struct mail_index_view *view, ctx->sync_map_update = TRUE; if (view->map->refcount > 1) { - map = mail_index_map_clone(view->map); + tmp_map = mail_index_map_clone(view->map); mail_index_unmap(&view->map); - view->map = map; - } else { - map = view->map; + view->map = tmp_map; } if (sync_expunges) { diff --git a/src/lib-index/mail-index-view.c b/src/lib-index/mail-index-view.c index 3fdae71ca2..ddfa08b6b9 100644 --- a/src/lib-index/mail-index-view.c +++ b/src/lib-index/mail-index-view.c @@ -278,7 +278,7 @@ mail_index_data_lookup_keywords(struct mail_index_map *map, return; keyword_idx_map = array_get(&map->keyword_idx_map, &keyword_count); - for (i = 0, idx = 0; i < record_size; i++) { + for (i = 0; i < record_size; i++) { /* first do the quick check to see if there's keywords at all */ if (data[i] == 0) continue; diff --git a/src/lib-index/mail-transaction-log-file.c b/src/lib-index/mail-transaction-log-file.c index 32db86889d..2fb34b638b 100644 --- a/src/lib-index/mail-transaction-log-file.c +++ b/src/lib-index/mail-transaction-log-file.c @@ -845,7 +845,7 @@ void mail_transaction_update_modseq(const struct mail_transaction_header *hdr, *cur_modseq += 1; break; case MAIL_TRANSACTION_MODSEQ_UPDATE: { - const struct mail_transaction_modseq_update *rec = data, *end; + const struct mail_transaction_modseq_update *rec, *end; end = CONST_PTR_OFFSET(data, trans_size - sizeof(*hdr)); for (rec = data; rec < end; rec++) { diff --git a/src/lib-lda/mail-send.c b/src/lib-lda/mail-send.c index b94e7cdcd7..2002f280ed 100644 --- a/src/lib-lda/mail-send.c +++ b/src/lib-lda/mail-send.c @@ -181,7 +181,6 @@ int mail_send_forward(struct mail_deliver_context *ctx, const char *forwardto) const unsigned char *data; const char *return_path; size_t size; - int ret; if (mail_get_stream(ctx->src_mail, NULL, NULL, &input) < 0) return -1; @@ -199,7 +198,7 @@ int mail_send_forward(struct mail_deliver_context *ctx, const char *forwardto) N_ELEMENTS(hide_headers), null_header_filter_callback, NULL); - while ((ret = i_stream_read_data(input, &data, &size, 0)) > 0) { + while (i_stream_read_data(input, &data, &size, 0) > 0) { if (fwrite(data, size, 1, f) == 0) break; i_stream_skip(input, size); diff --git a/src/lib-mail/message-header-decode.c b/src/lib-mail/message-header-decode.c index 243bd7b652..596e013da7 100644 --- a/src/lib-mail/message-header-decode.c +++ b/src/lib-mail/message-header-decode.c @@ -77,7 +77,7 @@ void message_header_decode(const unsigned char *data, size_t size, size_t pos, start_pos, ret; /* =?charset?Q|B?text?= */ - start_pos = pos = 0; + start_pos = 0; for (pos = 0; pos + 1 < size; ) { if (data[pos] != '=' || data[pos+1] != '?') { pos++; diff --git a/src/lib-mail/message-header-parser.c b/src/lib-mail/message-header-parser.c index d75db96063..a5eea65430 100644 --- a/src/lib-mail/message-header-parser.c +++ b/src/lib-mail/message-header-parser.c @@ -57,7 +57,7 @@ int message_parse_header_next(struct message_header_parser_ctx *ctx, { struct message_header_line *line = &ctx->line; const unsigned char *msg; - size_t i, size, startpos, colon_pos, parse_size, value_pos; + size_t i, size, startpos, colon_pos, parse_size; int ret; bool continued, continues, last_no_newline, last_crlf; bool no_newline, crlf_newline; @@ -342,7 +342,6 @@ int message_parse_header_next(struct message_header_parser_ctx *ctx, buffer_append_c(ctx->value_buf, '\r'); buffer_append_c(ctx->value_buf, '\n'); } - value_pos = ctx->value_buf->used; if ((ctx->flags & MESSAGE_HEADER_PARSER_FLAG_CLEAN_ONELINE) && line->value_len > 0 && line->value[0] != ' ' && IS_LWSP(line->value[0])) { diff --git a/src/lib-mail/test-istream-header-filter.c b/src/lib-mail/test-istream-header-filter.c index 1e3ed03191..17f2632430 100644 --- a/src/lib-mail/test-istream-header-filter.c +++ b/src/lib-mail/test-istream-header-filter.c @@ -25,7 +25,6 @@ static void test_istream_filter(void) unsigned int output_len = strlen(output); const unsigned char *data; size_t size; - ssize_t ret; test_begin("i_stream_create_header_filter()"); istream = test_istream_create(input); @@ -55,7 +54,7 @@ static void test_istream_filter(void) i_stream_skip(filter, size); i_stream_seek(filter, 0); - while ((ret = i_stream_read(filter)) > 0) ; + while (i_stream_read(filter) > 0) ; data = i_stream_get_data(filter, &size); test_assert(size == output_len && memcmp(data, output, size) == 0); diff --git a/src/lib-storage/index/cydir/cydir-save.c b/src/lib-storage/index/cydir/cydir-save.c index 01fac8adf4..c91899511d 100644 --- a/src/lib-storage/index/cydir/cydir-save.c +++ b/src/lib-storage/index/cydir/cydir-save.c @@ -59,8 +59,7 @@ struct mail_save_context * cydir_save_alloc(struct mailbox_transaction_context *t) { struct cydir_mailbox *mbox = (struct cydir_mailbox *)t->box; - struct cydir_save_context *ctx = - (struct cydir_save_context *)t->save_ctx; + struct cydir_save_context *ctx; i_assert((t->flags & MAILBOX_TRANSACTION_FLAG_EXTERNAL) != 0); diff --git a/src/lib-storage/index/dbox-common/dbox-file-fix.c b/src/lib-storage/index/dbox-common/dbox-file-fix.c index 81abe5e303..fc011ff053 100644 --- a/src/lib-storage/index/dbox-common/dbox-file-fix.c +++ b/src/lib-storage/index/dbox-common/dbox-file-fix.c @@ -36,7 +36,6 @@ dbox_file_find_next_magic(struct dbox_file *file, uoff_t *offset_r, bool *pre_r) orig_offset = input->v_offset; while ((ret = i_stream_read_data(input, &data, &size, 0)) > 0) { pre_offset = (uoff_t)-1; - post_offset = (uoff_t)-1; if (str_find_more(pre_ctx, data, size)) { pre_offset = input->v_offset + str_find_get_match_end_pos(pre_ctx) - @@ -292,16 +291,15 @@ dbox_file_fix_write_stream(struct dbox_file *file, uoff_t start_offset, int dbox_file_fix(struct dbox_file *file, uoff_t start_offset) { struct ostream *output; - const char *dir, *fname, *temp_path, *broken_path; + const char *dir, *p, *temp_path, *broken_path; bool deleted; int fd, ret; i_assert(dbox_file_is_open(file)); - fname = strrchr(file->cur_path, '/'); - i_assert(fname != NULL); - dir = t_strdup_until(file->cur_path, fname); - fname++; + p = strrchr(file->cur_path, '/'); + i_assert(p != NULL); + dir = t_strdup_until(file->cur_path, p); temp_path = t_strdup_printf("%s/%s", dir, dbox_generate_tmp_filename()); fd = file->storage->v.file_create_fd(file, temp_path, FALSE); diff --git a/src/lib-storage/index/dbox-multi/mdbox-file.c b/src/lib-storage/index/dbox-multi/mdbox-file.c index f91d616373..769f60c6e5 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-file.c +++ b/src/lib-storage/index/dbox-multi/mdbox-file.c @@ -232,7 +232,7 @@ static void mdbox_file_close_later(struct mdbox_file *mfile) void mdbox_file_unrefed(struct dbox_file *file) { struct mdbox_file *mfile = (struct mdbox_file *)file; - struct mdbox_file *const *files, *oldest_file; + struct mdbox_file *oldest_file; unsigned int i, count; /* don't cache metadata seeks while file isn't being referenced */ @@ -240,7 +240,7 @@ void mdbox_file_unrefed(struct dbox_file *file) mfile->close_time = ioloop_time; if (mfile->file_id != 0) { - files = array_get(&mfile->storage->open_files, &count); + count = array_count(&mfile->storage->open_files); if (!file->deleted && count <= MDBOX_MAX_OPEN_UNUSED_FILES) { /* we can leave this file open for now */ mdbox_file_close_later(mfile); diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index 396d0f261d..738fc45c23 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -1369,10 +1369,9 @@ void index_mail_cache_parse_continue(struct mail *_mail) { struct index_mail *mail = (struct index_mail *)_mail; struct message_block block; - int ret; - while ((ret = message_parser_parse_next_block(mail->data.parser_ctx, - &block)) > 0) { + while (message_parser_parse_next_block(mail->data.parser_ctx, + &block) > 0) { if (block.size != 0) continue; diff --git a/src/lib-storage/index/index-thread.c b/src/lib-storage/index/index-thread.c index b541edf5e4..5a8e007909 100644 --- a/src/lib-storage/index/index-thread.c +++ b/src/lib-storage/index/index-thread.c @@ -208,7 +208,6 @@ static void mail_thread_strmap_remap(const uint32_t *idx_map, pointers though. */ new_first_invalid = new_count + 1 + THREAD_INVALID_MSGID_STR_IDX_SKIP_COUNT; - i = cache->first_invalid_msgid_str_idx; for (i = 0; i < invalid_count; i++) { node = array_idx_modifiable(&new_nodes, new_first_invalid + i); *node = old_nodes[cache->first_invalid_msgid_str_idx + i]; diff --git a/src/lib-storage/index/maildir/maildir-save.c b/src/lib-storage/index/maildir/maildir-save.c index 9fed0014f3..69074859d9 100644 --- a/src/lib-storage/index/maildir/maildir-save.c +++ b/src/lib-storage/index/maildir/maildir-save.c @@ -140,9 +140,8 @@ maildir_save_transaction_init(struct mailbox_transaction_context *t) return &ctx->ctx; } -struct maildir_filename * -maildir_save_add(struct mail_save_context *_ctx, const char *base_fname, - bool preserve_filename) +void maildir_save_add(struct mail_save_context *_ctx, const char *base_fname, + bool preserve_filename) { struct maildir_save_context *ctx = (struct maildir_save_context *)_ctx; struct maildir_filename *mf; @@ -222,7 +221,6 @@ maildir_save_add(struct mail_save_context *_ctx, const char *base_fname, ctx->input = input; ctx->cur_dest_mail = _ctx->dest_mail; } - return mf; } static bool @@ -384,7 +382,6 @@ maildir_save_alloc(struct mailbox_transaction_context *t) int maildir_save_begin(struct mail_save_context *_ctx, struct istream *input) { struct maildir_save_context *ctx = (struct maildir_save_context *)_ctx; - struct maildir_filename *mf; T_BEGIN { /* create a new file in tmp/ directory */ @@ -398,7 +395,7 @@ int maildir_save_begin(struct mail_save_context *_ctx, struct istream *input) ctx->input = i_stream_create_crlf(input); else ctx->input = i_stream_create_lf(input); - mf = maildir_save_add(_ctx, fname, fname == _ctx->guid); + maildir_save_add(_ctx, fname, fname == _ctx->guid); } } T_END; @@ -836,11 +833,10 @@ maildir_save_move_files_to_newcur(struct maildir_save_context *ctx, { struct maildir_filename *mf; bool newdir, new_changed, cur_changed; - int ret = 0; + int ret; *last_mf_r = NULL; - ret = 0; new_changed = cur_changed = FALSE; for (mf = ctx->files; mf != NULL; mf = mf->next) { T_BEGIN { diff --git a/src/lib-storage/index/maildir/maildir-storage.h b/src/lib-storage/index/maildir/maildir-storage.h index 022ac64fdc..4004601fca 100644 --- a/src/lib-storage/index/maildir/maildir-storage.h +++ b/src/lib-storage/index/maildir/maildir-storage.h @@ -121,9 +121,8 @@ void maildir_save_cancel(struct mail_save_context *ctx); void maildir_save_add_conflict(struct mailbox_transaction_context *t, uint32_t old_uid, uint32_t new_uid); -struct maildir_filename * -maildir_save_add(struct mail_save_context *_ctx, const char *base_fname, - bool preserve_filename); +void maildir_save_add(struct mail_save_context *_ctx, const char *base_fname, + bool preserve_filename); const char *maildir_save_file_get_path(struct mailbox_transaction_context *t, uint32_t seq); diff --git a/src/lib-storage/index/maildir/maildir-sync.c b/src/lib-storage/index/maildir/maildir-sync.c index feba5fb66e..64f245a2cb 100644 --- a/src/lib-storage/index/maildir/maildir-sync.c +++ b/src/lib-storage/index/maildir/maildir-sync.c @@ -366,7 +366,7 @@ maildir_scan_dir(struct maildir_sync_context *ctx, bool new_dir, bool final) unsigned int i = 0, move_count = 0; time_t now; int ret = 1; - bool move_new, check_touch, dir_changed = FALSE; + bool move_new, dir_changed = FALSE; path = new_dir ? ctx->new_dir : ctx->cur_dir; for (i = 0;; i++) { @@ -427,7 +427,6 @@ maildir_scan_dir(struct maildir_sync_context *ctx, bool new_dir, bool final) if (dp->d_name[0] == '.') continue; - check_touch = FALSE; flags = 0; if (move_new) { str_truncate(src, 0); @@ -633,15 +632,13 @@ static int maildir_sync_quick_check(struct maildir_mailbox *mbox, bool undirty, static void maildir_sync_update_next_uid(struct maildir_mailbox *mbox) { const struct mail_index_header *hdr; - uint32_t uid_validity, next_uid; + uint32_t uid_validity; hdr = mail_index_get_header(mbox->box.view); if (hdr->uid_validity == 0) return; uid_validity = maildir_uidlist_get_uid_validity(mbox->uidlist); - next_uid = maildir_uidlist_get_next_uid(mbox->uidlist); - if (uid_validity == hdr->uid_validity || uid_validity == 0) { /* make sure uidlist's next_uid is at least as large as index file's. typically this happens only if uidlist gets diff --git a/src/lib-storage/index/mbox/istream-raw-mbox.c b/src/lib-storage/index/mbox/istream-raw-mbox.c index 603ab15faf..177c5f0c2b 100644 --- a/src/lib-storage/index/mbox/istream-raw-mbox.c +++ b/src/lib-storage/index/mbox/istream-raw-mbox.c @@ -184,7 +184,6 @@ static ssize_t i_stream_raw_mbox_read(struct istream_private *stream) stream->skip = 0; stream->buffer = NULL; - ret = 0; do { buf = i_stream_get_data(stream->parent, &pos); if (pos > 1 && stream->istream.v_offset + pos > diff --git a/src/lib-storage/index/mbox/mbox-lock.c b/src/lib-storage/index/mbox/mbox-lock.c index 3adf0bffca..2a677b97a4 100644 --- a/src/lib-storage/index/mbox/mbox-lock.c +++ b/src/lib-storage/index/mbox/mbox-lock.c @@ -457,7 +457,7 @@ static int mbox_lock_dotlock_try(struct mbox_lock_context *ctx, int lock_type, static int mbox_lock_flock(struct mbox_lock_context *ctx, int lock_type, time_t max_wait_time) { - time_t now, last_notify; + time_t now; unsigned int next_alarm; if (mbox_file_open_latest(ctx, lock_type) < 0) @@ -485,7 +485,6 @@ static int mbox_lock_flock(struct mbox_lock_context *ctx, int lock_type, alarm(I_MIN(max_wait_time - now, 5)); } - last_notify = 0; while (flock(ctx->mbox->mbox_fd, lock_type) < 0) { if (errno != EINTR) { if (errno == EWOULDBLOCK && max_wait_time == 0) { @@ -524,7 +523,7 @@ static int mbox_lock_flock(struct mbox_lock_context *ctx, int lock_type, static int mbox_lock_lockf(struct mbox_lock_context *ctx, int lock_type, time_t max_wait_time) { - time_t now, last_notify; + time_t now; unsigned int next_alarm; if (mbox_file_open_latest(ctx, lock_type) < 0) @@ -548,7 +547,6 @@ static int mbox_lock_lockf(struct mbox_lock_context *ctx, int lock_type, lock_type = F_LOCK; } - last_notify = 0; while (lockf(ctx->mbox->mbox_fd, lock_type, 0) < 0) { if (errno != EINTR) { if ((errno == EACCES || errno == EAGAIN) && diff --git a/src/lib-storage/index/mbox/mbox-save.c b/src/lib-storage/index/mbox/mbox-save.c index ce789ef928..8c653302e8 100644 --- a/src/lib-storage/index/mbox/mbox-save.c +++ b/src/lib-storage/index/mbox/mbox-save.c @@ -200,7 +200,6 @@ static void status_flags_append(string_t *str, enum mail_flags flags, if ((flags & flags_list[i].flag) != 0) str_append_c(str, flags_list[i].chr); } - flags ^= MBOX_NONRECENT_KLUDGE; } static void mbox_save_append_flag_headers(string_t *str, enum mail_flags flags) diff --git a/src/lib-storage/index/mbox/mbox-sync-update.c b/src/lib-storage/index/mbox/mbox-sync-update.c index d5d8faae56..07b7292afc 100644 --- a/src/lib-storage/index/mbox/mbox-sync-update.c +++ b/src/lib-storage/index/mbox/mbox-sync-update.c @@ -112,7 +112,7 @@ static void status_flags_replace(struct mbox_sync_mail_context *ctx, size_t pos, /* @UNSAFE */ data = buffer_get_space_unsafe(ctx->header, pos, need); - for (i = 0, need = 0; flags_list[i].chr != 0; i++) { + for (i = 0; flags_list[i].chr != 0; i++) { if ((ctx->mail.flags & flags_list[i].flag) != 0) *data++ = flags_list[i].chr; } @@ -187,11 +187,9 @@ keywords_append_all(struct mbox_sync_mail_context *ctx, string_t *dest, static void mbox_sync_add_missing_headers(struct mbox_sync_mail_context *ctx) { - size_t old_hdr_size, new_hdr_size, startpos; + size_t new_hdr_size, startpos; - old_hdr_size = ctx->body_offset - ctx->hdr_offset; new_hdr_size = str_len(ctx->header); - if (new_hdr_size > 0 && str_data(ctx->header)[new_hdr_size-1] != '\n') { /* broken header - doesn't end with \n. fix it. */ diff --git a/src/lib-storage/list/mailbox-list-fs.c b/src/lib-storage/list/mailbox-list-fs.c index f09c90d5f3..1238ff9898 100644 --- a/src/lib-storage/list/mailbox-list-fs.c +++ b/src/lib-storage/list/mailbox-list-fs.c @@ -501,7 +501,7 @@ static int fs_list_rename_mailbox(struct mailbox_list *oldlist, const char *newname, bool rename_children) { struct mail_storage *oldstorage; - const char *oldpath, *newpath, *alt_oldpath, *alt_newpath, *root_path; + const char *oldpath, *newpath, *alt_newpath, *root_path; const char *p, *origin; enum mailbox_list_path_type path_type, alt_path_type; struct stat st; @@ -528,7 +528,6 @@ static int fs_list_rename_mailbox(struct mailbox_list *oldlist, oldpath = mailbox_list_get_path(oldlist, oldname, path_type); newpath = mailbox_list_get_path(newlist, newname, path_type); - alt_oldpath = mailbox_list_get_path(oldlist, oldname, alt_path_type); alt_newpath = mailbox_list_get_path(newlist, newname, alt_path_type); root_path = mailbox_list_get_path(oldlist, NULL, diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index 8fda54dabb..f9950ba13d 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -116,7 +116,7 @@ user_reply_handle(struct mail_storage_service_user *user, const char **error_r) { struct setting_parser_context *set_parser = user->set_parser; - const char *const *str, *p, *line, *key; + const char *const *str, *line, *key; unsigned int i, count; bool mail_debug; int ret = 0; @@ -163,7 +163,7 @@ user_reply_handle(struct mail_storage_service_user *user, } #endif } else T_BEGIN { - if ((p = strchr(str[i], '=')) == NULL) + if (strchr(str[i], '=') == NULL) line = t_strconcat(str[i], "=yes", NULL); else line = str[i]; @@ -464,9 +464,6 @@ static void mail_storage_service_init_log(struct master_service *service, struct mail_storage_service_user *user) { - const struct mail_user_settings *user_set; - - user_set = master_service_settings_get_others(service)[0]; T_BEGIN { string_t *str; diff --git a/src/lib/askpass.c b/src/lib/askpass.c index b79468fc33..de98b13897 100644 --- a/src/lib/askpass.c +++ b/src/lib/askpass.c @@ -12,7 +12,6 @@ void askpass(const char *prompt, char *buf, size_t buf_size) { struct termios old_tio, tio; bool restore_tio = FALSE; - ssize_t ret; size_t pos; char ch; int fd; @@ -37,7 +36,7 @@ void askpass(const char *prompt, char *buf, size_t buf_size) /* read the password */ pos = 0; - while ((ret = read(fd, &ch, 1)) > 0) { + while (read(fd, &ch, 1) > 0) { if (pos >= buf_size-1) break; if (ch == '\n' || ch == '\r') diff --git a/src/lib/file-cache.c b/src/lib/file-cache.c index ccf48fdc5b..d77611ffca 100644 --- a/src/lib/file-cache.c +++ b/src/lib/file-cache.c @@ -310,7 +310,6 @@ void file_cache_invalidate(struct file_cache *cache, uoff_t offset, uoff_t size) /* set the last byte */ if (size > 0) { - mask = 0; for (i = 0, mask = 0; i < size; i++) mask |= 1 << i; *bits &= ~mask; diff --git a/src/lib/file-dotlock.c b/src/lib/file-dotlock.c index 882500e129..f5627c12d2 100644 --- a/src/lib/file-dotlock.c +++ b/src/lib/file-dotlock.c @@ -507,7 +507,6 @@ dotlock_create(struct dotlock *dotlock, enum dotlock_create_flags flags, lock_info.wait_usecs += lock_info.wait_usecs/2; } dotlock_wait(&lock_info); - do_wait = FALSE; } ret = check_lock(now, &lock_info); @@ -526,7 +525,6 @@ dotlock_create(struct dotlock *dotlock, enum dotlock_create_flags flags, break; } - do_wait = TRUE; if (last_notify != now && set->callback != NULL) { last_notify = now; change_secs = now - lock_info.last_change; @@ -548,6 +546,7 @@ dotlock_create(struct dotlock *dotlock, enum dotlock_create_flags flags, } } + do_wait = TRUE; now = time(NULL); } while (now < max_wait_time); diff --git a/src/lib/home-expand.c b/src/lib/home-expand.c index c62c8b98c7..ae9ec404fb 100644 --- a/src/lib/home-expand.c +++ b/src/lib/home-expand.c @@ -9,13 +9,13 @@ int home_try_expand(const char **_path) { const char *path = *_path; - const char *home, *p, *orig_path; + const char *home, *p; struct passwd *pw; if (path == NULL || *path != '~') return 0; - orig_path = path++; + path++; if (*path == '/' || *path == '\0') { home = getenv("HOME"); if (*path != '\0') path++; diff --git a/src/lib/istream-tee.c b/src/lib/istream-tee.c index 490fb86060..a126231594 100644 --- a/src/lib/istream-tee.c +++ b/src/lib/istream-tee.c @@ -138,7 +138,7 @@ static ssize_t i_stream_tee_read(struct istream_private *stream) tee_streams_skip(tstream->tee); ret = i_stream_read(input); if (ret <= 0) { - data = i_stream_get_data(input, &size); + (void)i_stream_get_data(input, &size); if (ret == -2 && stream->skip != 0) { /* someone else is holding the data, wait for it */ diff --git a/src/lib/seq-range-array.c b/src/lib/seq-range-array.c index 759c81b819..4ef9f0410f 100644 --- a/src/lib/seq-range-array.c +++ b/src/lib/seq-range-array.c @@ -188,7 +188,7 @@ bool seq_range_array_remove(ARRAY_TYPE(seq_range) *array, uint32_t seq) /* somewhere in the middle, array is sorted so find it with binary search */ - idx = 0; left_idx = 0; right_idx = count; + left_idx = 0; right_idx = count; while (left_idx < right_idx) { idx = (left_idx + right_idx) / 2; diff --git a/src/lib/strescape.c b/src/lib/strescape.c index 675d8a2c43..da4feab45a 100644 --- a/src/lib/strescape.c +++ b/src/lib/strescape.c @@ -36,7 +36,6 @@ void str_append_unescaped(string_t *dest, const void *src, size_t src_size) size_t start = 0, i = 0; while (i < src_size) { - start = i; for (; i < src_size; i++) { if (src_c[i] == '\\') break; @@ -127,7 +126,6 @@ void str_append_tabunescaped(string_t *dest, const void *src, size_t src_size) size_t start = 0, i = 0; while (i < src_size) { - start = i; for (; i < src_size; i++) { if (src_c[i] == '\001') break; diff --git a/src/lib/strfuncs.c b/src/lib/strfuncs.c index d77b4f11bb..86f0ad2499 100644 --- a/src/lib/strfuncs.c +++ b/src/lib/strfuncs.c @@ -306,7 +306,7 @@ int i_strocpy(char *dest, const char *src, size_t dstsize) dstsize--; } - *dest++ = '\0'; + *dest = '\0'; return *src == '\0' ? 0 : -1; } diff --git a/src/login-common/client-common-auth.c b/src/login-common/client-common-auth.c index 61ce699e9f..8c9d588037 100644 --- a/src/login-common/client-common-auth.c +++ b/src/login-common/client-common-auth.c @@ -342,9 +342,7 @@ int client_auth_parse_response(struct client *client) static void client_auth_input(struct client *client) { - int ret; - - if ((ret = client->v.auth_parse_response(client)) <= 0) + if (client->v.auth_parse_response(client) <= 0) return; client_set_auth_waiting(client); diff --git a/src/login-common/ssl-proxy-openssl.c b/src/login-common/ssl-proxy-openssl.c index 4f94e3d9b7..c9a531a66d 100644 --- a/src/login-common/ssl-proxy-openssl.c +++ b/src/login-common/ssl-proxy-openssl.c @@ -362,12 +362,12 @@ static const char *ssl_err2str(unsigned long err, const char *data, int flags) static const char *ssl_last_error(void) { - unsigned long err, err2; + unsigned long err; const char *data; int flags; err = ERR_get_error_line_data(NULL, NULL, &data, &flags); - while (err != 0 && (err2 = ERR_peek_error()) != 0) { + while (err != 0 && ERR_peek_error() != 0) { i_error("SSL: Stacked error: %s", ssl_err2str(err, data, flags)); err = ERR_get_error(); diff --git a/src/master/main.c b/src/master/main.c index 00ff7af897..926e452f00 100644 --- a/src/master/main.c +++ b/src/master/main.c @@ -768,7 +768,7 @@ int main(int argc, char *argv[]) } i_assert(child_process_env_idx < sizeof(child_process_env) / sizeof(child_process_env[0])); - child_process_env[child_process_env_idx++] = NULL; + child_process_env[child_process_env_idx] = NULL; /* create service structures from settings. if there are any errors in service configuration we'll catch it here. */ diff --git a/src/plugins/fts-squat/squat-trie.c b/src/plugins/fts-squat/squat-trie.c index a8c53af722..268d8402bf 100644 --- a/src/plugins/fts-squat/squat-trie.c +++ b/src/plugins/fts-squat/squat-trie.c @@ -389,7 +389,6 @@ node_add_child(struct squat_trie *trie, struct squat_node *node, /* first child */ node->children.data = i_malloc(new_size); trie->node_alloc_size += new_size; - children = NODE_CHILDREN_NODES(node); } else { old_size = NODE_CHILDREN_ALLOC_SIZE(old_child_count); if (old_size != new_size) { diff --git a/src/plugins/lazy-expunge/lazy-expunge-plugin.c b/src/plugins/lazy-expunge/lazy-expunge-plugin.c index 5e82a26bb3..4cee6cb613 100644 --- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c +++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c @@ -74,7 +74,6 @@ mailbox_open_or_create(struct mailbox_list *list, const char *name, const char **error_r) { struct mailbox *box; - struct mail_storage *storage; enum mail_error error; box = mailbox_alloc(list, name, MAILBOX_FLAG_KEEP_RECENT | @@ -92,7 +91,6 @@ mailbox_open_or_create(struct mailbox_list *list, const char *name, } /* try creating and re-opening it. */ - storage = mail_namespace_get_default_storage(list->ns); if (mailbox_create(box, NULL, FALSE) < 0 || mailbox_open(box) < 0) { *error_r = mail_storage_get_last_error(mailbox_get_storage(box), diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index a1a0f79e42..580cd6558f 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -535,9 +535,7 @@ static void client_input(struct client *client) static int client_output(struct client *client) { - int ret; - - if ((ret = o_stream_flush(client->output)) < 0) { + if (o_stream_flush(client->output) < 0) { client_destroy(client, NULL); return 1; } diff --git a/src/util/maildirlock.c b/src/util/maildirlock.c index 193c6d9906..31581c7e87 100644 --- a/src/util/maildirlock.c +++ b/src/util/maildirlock.c @@ -39,7 +39,7 @@ int main(int argc, const char *argv[]) { struct dotlock *dotlock; unsigned int timeout; - pid_t pid, parent_pid; + pid_t pid; int fd[2], ret; char c; @@ -48,7 +48,6 @@ int main(int argc, const char *argv[]) " - SIGTERM will release the lock.\n"); return 1; } - parent_pid = getpid(); if (pipe(fd) != 0) { fprintf(stderr, "pipe() failed: %s", strerror(errno)); return 1;