From: Timo Sirainen Date: Mon, 25 Jun 2012 00:21:25 +0000 (+0300) Subject: Avoid using (void)s by adding ATTR_NOWARN_UNUSED_RESULT attributes and other ways. X-Git-Tag: 2.2.alpha1~454 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b66d803de86bfb411165b3465b0d9ef64ecfe2a1;p=thirdparty%2Fdovecot%2Fcore.git Avoid using (void)s by adding ATTR_NOWARN_UNUSED_RESULT attributes and other ways. --- diff --git a/src/auth/auth-worker-server.h b/src/auth/auth-worker-server.h index ed492b329e..1c1f7b4f27 100644 --- a/src/auth/auth-worker-server.h +++ b/src/auth/auth-worker-server.h @@ -6,7 +6,7 @@ struct auth_stream_reply; typedef bool auth_worker_callback_t(const char *reply, void *context); -struct auth_worker_connection * +struct auth_worker_connection * ATTR_NOWARN_UNUSED_RESULT auth_worker_call(pool_t pool, struct auth_stream_reply *data, auth_worker_callback_t *callback, void *context); void auth_worker_server_resume_input(struct auth_worker_connection *conn); diff --git a/src/auth/passdb-blocking.c b/src/auth/passdb-blocking.c index 6de2d51a15..6cb9980b54 100644 --- a/src/auth/passdb-blocking.c +++ b/src/auth/passdb-blocking.c @@ -88,8 +88,7 @@ void passdb_blocking_verify_plain(struct auth_request *request) auth_request_export(request, reply); auth_request_ref(request); - (void)auth_worker_call(request->pool, reply, - verify_plain_callback, request); + auth_worker_call(request->pool, reply, verify_plain_callback, request); } static bool lookup_credentials_callback(const char *reply, void *context) @@ -131,8 +130,8 @@ void passdb_blocking_lookup_credentials(struct auth_request *request) auth_request_export(request, reply); auth_request_ref(request); - (void)auth_worker_call(request->pool, reply, - lookup_credentials_callback, request); + auth_worker_call(request->pool, reply, + lookup_credentials_callback, request); } static bool @@ -159,6 +158,6 @@ void passdb_blocking_set_credentials(struct auth_request *request, auth_request_export(request, reply); auth_request_ref(request); - (void)auth_worker_call(request->pool, reply, - set_credentials_callback, request); + auth_worker_call(request->pool, reply, + set_credentials_callback, request); } diff --git a/src/auth/userdb-blocking.c b/src/auth/userdb-blocking.c index 88910d7d1e..a89a99899a 100644 --- a/src/auth/userdb-blocking.c +++ b/src/auth/userdb-blocking.c @@ -58,7 +58,7 @@ void userdb_blocking_lookup(struct auth_request *request) auth_request_export(request, reply); auth_request_ref(request); - (void)auth_worker_call(request->pool, reply, user_callback, request); + auth_worker_call(request->pool, reply, user_callback, request); } static bool iter_callback(const char *reply, void *context) diff --git a/src/doveadm/doveadm-mail-expunge.c b/src/doveadm/doveadm-mail-expunge.c index 4913b50266..8751eeda40 100644 --- a/src/doveadm/doveadm-mail-expunge.c +++ b/src/doveadm/doveadm-mail-expunge.c @@ -48,7 +48,7 @@ cmd_expunge_box(struct doveadm_mail_cmd_context *_ctx, if (ctx->delete_empty_mailbox && ret == 0) { if (mailbox_delete_empty(box) < 0) { - (void)mailbox_get_last_error(box, &error); + error = mailbox_get_last_mail_error(box); if (error != MAIL_ERROR_EXISTS) { doveadm_mail_failed_mailbox(_ctx, box); ret = -1; diff --git a/src/doveadm/doveadm-mail.c b/src/doveadm/doveadm-mail.c index e1f7157807..ecedcdc278 100644 --- a/src/doveadm/doveadm-mail.c +++ b/src/doveadm/doveadm-mail.c @@ -76,7 +76,7 @@ void doveadm_mail_failed_storage(struct doveadm_mail_cmd_context *ctx, { enum mail_error error; - (void)mail_storage_get_last_error(storage, &error); + mail_storage_get_last_error(storage, &error); doveadm_mail_failed_error(ctx, error); } diff --git a/src/doveadm/dsync/dsync-brain-mailbox-tree.c b/src/doveadm/dsync/dsync-brain-mailbox-tree.c index fa664e625f..b6422cee2b 100644 --- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c +++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c @@ -122,8 +122,8 @@ void dsync_brain_send_mailbox_tree_deletes(struct dsync_brain *brain) deletes = dsync_mailbox_tree_get_deletes(brain->local_mailbox_tree, &count); - (void)dsync_slave_send_mailbox_deletes(brain->slave, deletes, count, - brain->hierarchy_sep); + dsync_slave_send_mailbox_deletes(brain->slave, deletes, count, + brain->hierarchy_sep); brain->state = DSYNC_STATE_RECV_MAILBOX_TREE; } diff --git a/src/doveadm/dsync/dsync-brain-mailbox.c b/src/doveadm/dsync/dsync-brain-mailbox.c index 4844e6e261..13316ab679 100644 --- a/src/doveadm/dsync/dsync-brain-mailbox.c +++ b/src/doveadm/dsync/dsync-brain-mailbox.c @@ -372,7 +372,7 @@ void dsync_brain_master_send_mailbox(struct dsync_brain *brain) } /* start exporting this mailbox (wait for remote to start importing) */ - (void)dsync_slave_send_mailbox(brain->slave, &dsync_box); + dsync_slave_send_mailbox(brain->slave, &dsync_box); (void)dsync_brain_sync_mailbox_init(brain, box, &dsync_box, DSYNC_BOX_STATE_MAILBOX); brain->state = DSYNC_STATE_SYNC_MAILS; @@ -560,13 +560,13 @@ bool dsync_brain_slave_recv_mailbox(struct dsync_brain *brain) memcpy(delete_box.mailbox_guid, dsync_box->mailbox_guid, sizeof(delete_box.mailbox_guid)); delete_box.mailbox_lost = TRUE; - (void)dsync_slave_send_mailbox(brain->slave, &delete_box); + dsync_slave_send_mailbox(brain->slave, &delete_box); return TRUE; } i_assert(local_dsync_box.uid_validity != 0); i_assert(memcmp(dsync_box->mailbox_guid, local_dsync_box.mailbox_guid, sizeof(dsync_box->mailbox_guid)) == 0); - (void)dsync_slave_send_mailbox(brain->slave, &local_dsync_box); + dsync_slave_send_mailbox(brain->slave, &local_dsync_box); dsync_brain_mailbox_update_pre(brain, box, &local_dsync_box, dsync_box); diff --git a/src/doveadm/dsync/dsync-brain-mails.c b/src/doveadm/dsync/dsync-brain-mails.c index e3ca4c975a..33f95e53be 100644 --- a/src/doveadm/dsync/dsync-brain-mails.c +++ b/src/doveadm/dsync/dsync-brain-mails.c @@ -155,7 +155,7 @@ static void dsync_brain_sync_half_finished(struct dsync_brain *brain) if (changes_during_sync) brain->changes_during_sync = TRUE; } - (void)dsync_slave_send_mailbox_state(brain->slave, &state); + dsync_slave_send_mailbox_state(brain->slave, &state); } static bool dsync_brain_recv_mail(struct dsync_brain *brain) diff --git a/src/doveadm/dsync/dsync-slave-pipe.c b/src/doveadm/dsync/dsync-slave-pipe.c index 88192724c0..93c68354cb 100644 --- a/src/doveadm/dsync/dsync-slave-pipe.c +++ b/src/doveadm/dsync/dsync-slave-pipe.c @@ -68,7 +68,7 @@ static pool_t dsync_slave_pipe_get_pool(struct dsync_slave_pipe *pipe) return ret; } -static struct item * +static struct item * ATTR_NOWARN_UNUSED_RESULT dsync_slave_pipe_push_item(struct dsync_slave_pipe *pipe, enum item_type type) { struct item *item; @@ -193,7 +193,7 @@ dsync_slave_pipe_send_end_of_list(struct dsync_slave *slave) { struct dsync_slave_pipe *pipe = (struct dsync_slave_pipe *)slave; - (void)dsync_slave_pipe_push_item(pipe->remote, ITEM_END_OF_LIST); + dsync_slave_pipe_push_item(pipe->remote, ITEM_END_OF_LIST); } static void diff --git a/src/doveadm/dsync/dsync-slave.c b/src/doveadm/dsync/dsync-slave.c index 30860ffe96..a63e16338b 100644 --- a/src/doveadm/dsync/dsync-slave.c +++ b/src/doveadm/dsync/dsync-slave.c @@ -40,9 +40,11 @@ dsync_slave_send_ret(struct dsync_slave *slave) DSYNC_SLAVE_SEND_RET_OK; } -void dsync_slave_send_end_of_list(struct dsync_slave *slave) +enum dsync_slave_send_ret +dsync_slave_send_end_of_list(struct dsync_slave *slave) { slave->v.send_end_of_list(slave); + return dsync_slave_send_ret(slave); } enum dsync_slave_send_ret diff --git a/src/doveadm/dsync/dsync-slave.h b/src/doveadm/dsync/dsync-slave.h index b436450a82..629e0702b7 100644 --- a/src/doveadm/dsync/dsync-slave.h +++ b/src/doveadm/dsync/dsync-slave.h @@ -54,16 +54,17 @@ enum dsync_slave_recv_ret dsync_slave_recv_handshake(struct dsync_slave *slave, const struct dsync_slave_settings **set_r); -void dsync_slave_send_end_of_list(struct dsync_slave *slave); +enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT +dsync_slave_send_end_of_list(struct dsync_slave *slave); -enum dsync_slave_send_ret +enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT dsync_slave_send_mailbox_state(struct dsync_slave *slave, const struct dsync_mailbox_state *state); enum dsync_slave_recv_ret dsync_slave_recv_mailbox_state(struct dsync_slave *slave, struct dsync_mailbox_state *state_r); -enum dsync_slave_send_ret +enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT dsync_slave_send_mailbox_tree_node(struct dsync_slave *slave, const char *const *name, const struct dsync_mailbox_node *node); @@ -72,7 +73,7 @@ dsync_slave_recv_mailbox_tree_node(struct dsync_slave *slave, const char *const **name_r, const struct dsync_mailbox_node **node_r); -enum dsync_slave_send_ret +enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT dsync_slave_send_mailbox_deletes(struct dsync_slave *slave, const struct dsync_mailbox_delete *deletes, unsigned int count, char hierarchy_sep); @@ -81,28 +82,28 @@ dsync_slave_recv_mailbox_deletes(struct dsync_slave *slave, const struct dsync_mailbox_delete **deletes_r, unsigned int *count_r, char *hierarchy_sep_r); -enum dsync_slave_send_ret +enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT dsync_slave_send_mailbox(struct dsync_slave *slave, const struct dsync_mailbox *dsync_box); enum dsync_slave_recv_ret dsync_slave_recv_mailbox(struct dsync_slave *slave, const struct dsync_mailbox **dsync_box_r); -enum dsync_slave_send_ret +enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT dsync_slave_send_change(struct dsync_slave *slave, const struct dsync_mail_change *change); enum dsync_slave_recv_ret dsync_slave_recv_change(struct dsync_slave *slave, const struct dsync_mail_change **change_r); -enum dsync_slave_send_ret +enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT dsync_slave_send_mail_request(struct dsync_slave *slave, const struct dsync_mail_request *request); enum dsync_slave_recv_ret dsync_slave_recv_mail_request(struct dsync_slave *slave, const struct dsync_mail_request **request_r); -enum dsync_slave_send_ret +enum dsync_slave_send_ret ATTR_NOWARN_UNUSED_RESULT dsync_slave_send_mail(struct dsync_slave *slave, const struct dsync_mail *mail); enum dsync_slave_recv_ret diff --git a/src/doveadm/dsync/dsync-transaction-log-scan.c b/src/doveadm/dsync/dsync-transaction-log-scan.c index 641559f0ce..2b2fbe8cc6 100644 --- a/src/doveadm/dsync/dsync-transaction-log-scan.c +++ b/src/doveadm/dsync/dsync-transaction-log-scan.c @@ -19,7 +19,7 @@ struct dsync_transaction_log_scan { bool returned_all_changes; }; -static bool +static bool ATTR_NOWARN_UNUSED_RESULT export_change_get(struct dsync_transaction_log_scan *ctx, uint32_t uid, enum dsync_mail_change_type type, struct dsync_mail_change **change_r) @@ -74,9 +74,9 @@ log_add_expunge(struct dsync_transaction_log_scan *ctx, const void *data, end = CONST_PTR_OFFSET(data, hdr->size); for (; rec != end; rec++) { for (uid = rec->uid1; uid <= rec->uid2; uid++) { - (void)export_change_get(ctx, uid, - DSYNC_MAIL_CHANGE_TYPE_EXPUNGE, - &change); + export_change_get(ctx, uid, + DSYNC_MAIL_CHANGE_TYPE_EXPUNGE, + &change); } } } @@ -95,9 +95,9 @@ log_add_expunge_uid(struct dsync_transaction_log_scan *ctx, const void *data, end = CONST_PTR_OFFSET(data, hdr->size); for (; rec != end; rec++) { if (uid >= rec->uid1 && uid <= rec->uid2) { - (void)export_change_get(ctx, uid, - DSYNC_MAIL_CHANGE_TYPE_EXPUNGE, - &change); + export_change_get(ctx, uid, + DSYNC_MAIL_CHANGE_TYPE_EXPUNGE, + &change); return TRUE; } } diff --git a/src/imap-login/client.c b/src/imap-login/client.c index d764cb89af..212bdc0951 100644 --- a/src/imap-login/client.c +++ b/src/imap-login/client.c @@ -371,7 +371,7 @@ static void imap_client_input(struct client *client) } } o_stream_uncork(imap_client->common.output); - (void)client_unref(&client); + client_unref(&client); } static struct client *imap_client_alloc(pool_t pool) diff --git a/src/imap/cmd-append.c b/src/imap/cmd-append.c index 32af8d8270..4a1deb9ade 100644 --- a/src/imap/cmd-append.c +++ b/src/imap/cmd-append.c @@ -114,7 +114,7 @@ static void client_input_append(struct client_command_context *cmd) (void)client_handle_unfinished_cmd(cmd); else client_command_free(&cmd); - (void)cmd_sync_delayed(client); + cmd_sync_delayed(client); o_stream_uncork(client->output); if (client->disconnected) diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 40ba0ebcad..eff53a6c46 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -807,7 +807,7 @@ bool client_handle_input(struct client *client) return FALSE; if (client->input_lock == NULL) - (void)cmd_sync_delayed(client); + cmd_sync_delayed(client); return TRUE; } @@ -912,7 +912,7 @@ int client_output(struct client *client) } } - (void)cmd_sync_delayed(client); + cmd_sync_delayed(client); o_stream_uncork(client->output); if (client->disconnected) client_destroy(client, NULL); diff --git a/src/imap/imap-common.h b/src/imap/imap-common.h index ec4aff3cbb..fbe0043896 100644 --- a/src/imap/imap-common.h +++ b/src/imap/imap-common.h @@ -23,7 +23,7 @@ extern imap_client_created_func_t *hook_client_created; /* Sets the hook_client_created and returns the previous hook, which the new_hook should call if it's non-NULL. */ -imap_client_created_func_t * +imap_client_created_func_t * ATTR_NOWARN_UNUSED_RESULT imap_client_created_hook_set(imap_client_created_func_t *new_hook); void imap_refresh_proctitle(void); diff --git a/src/imap/imap-search.c b/src/imap/imap-search.c index 5bae74e8a0..b7123f69d5 100644 --- a/src/imap/imap-search.c +++ b/src/imap/imap-search.c @@ -490,7 +490,7 @@ static void cmd_search_more_callback(struct client_command_context *cmd) (void)client_handle_unfinished_cmd(cmd); else client_command_free(&cmd); - (void)cmd_sync_delayed(client); + cmd_sync_delayed(client); if (client->disconnected) client_destroy(client, NULL); diff --git a/src/imap/imap-sync.c b/src/imap/imap-sync.c index 150ea372a9..2fa3ca5c87 100644 --- a/src/imap/imap-sync.c +++ b/src/imap/imap-sync.c @@ -603,7 +603,7 @@ static bool cmd_sync_client(struct client_command_context *sync_cmd) } client_command_free(&sync_cmd); - (void)cmd_sync_delayed(client); + cmd_sync_delayed(client); return TRUE; } diff --git a/src/imap/imap-sync.h b/src/imap/imap-sync.h index 37d0cc9a00..e5b49d9a86 100644 --- a/src/imap/imap-sync.h +++ b/src/imap/imap-sync.h @@ -26,6 +26,6 @@ bool cmd_sync_callback(struct client_command_context *cmd, enum mailbox_sync_flags flags, enum imap_sync_flags imap_flags, imap_sync_callback_t *callback); -bool cmd_sync_delayed(struct client *client); +bool cmd_sync_delayed(struct client *client) ATTR_NOWARN_UNUSED_RESULT; #endif diff --git a/src/lib-dict/dict-client.c b/src/lib-dict/dict-client.c index 18394bfb8d..bcaee6b3e5 100644 --- a/src/lib-dict/dict-client.c +++ b/src/lib-dict/dict-client.c @@ -207,7 +207,7 @@ client_dict_transaction_send_begin(struct client_dict_transaction_context *ctx) return ctx->failed ? -1 : 0; } -static int +static int ATTR_NOWARN_UNUSED_RESULT client_dict_send_transaction_query(struct client_dict_transaction_context *ctx, const char *query) { @@ -743,7 +743,7 @@ client_dict_transaction_rollback(struct dict_transaction_context *_ctx) query = t_strdup_printf("%c%u\n", DICT_PROTOCOL_CMD_ROLLBACK, ctx->id); - (void)client_dict_send_transaction_query(ctx, query); + client_dict_send_transaction_query(ctx, query); } T_END; DLLIST_REMOVE(&dict->transactions, ctx); @@ -765,7 +765,7 @@ static void client_dict_set(struct dict_transaction_context *_ctx, DICT_PROTOCOL_CMD_SET, ctx->id, dict_client_escape(key), dict_client_escape(value)); - (void)client_dict_send_transaction_query(ctx, query); + client_dict_send_transaction_query(ctx, query); } T_END; } @@ -781,7 +781,7 @@ static void client_dict_unset(struct dict_transaction_context *_ctx, query = t_strdup_printf("%c%u\t%s\n", DICT_PROTOCOL_CMD_UNSET, ctx->id, dict_client_escape(key)); - (void)client_dict_send_transaction_query(ctx, query); + client_dict_send_transaction_query(ctx, query); } T_END; } @@ -796,7 +796,7 @@ static void client_dict_atomic_inc(struct dict_transaction_context *_ctx, query = t_strdup_printf("%c%u\t%s\t%lld\n", DICT_PROTOCOL_CMD_ATOMIC_INC, ctx->id, dict_client_escape(key), diff); - (void)client_dict_send_transaction_query(ctx, query); + client_dict_send_transaction_query(ctx, query); } T_END; } diff --git a/src/lib-dict/dict-file.c b/src/lib-dict/dict-file.c index 3d96acc94f..6a9782d5e7 100644 --- a/src/lib-dict/dict-file.c +++ b/src/lib-dict/dict-file.c @@ -492,7 +492,7 @@ static int file_dict_write_changes(struct file_dict_transaction_context *ctx) /* refresh once more now that we're locked */ if (file_dict_refresh(dict) < 0) { if (dotlock != NULL) - (void)file_dotlock_delete(&dotlock); + file_dotlock_delete(&dotlock); else { i_close_fd(fd); file_unlock(&lock); diff --git a/src/lib-imap-client/imapc-connection.c b/src/lib-imap-client/imapc-connection.c index c64dcf8f98..678276cc9d 100644 --- a/src/lib-imap-client/imapc-connection.c +++ b/src/lib-imap-client/imapc-connection.c @@ -1202,8 +1202,8 @@ static int imapc_connection_ssl_init(struct imapc_connection *conn) if (*conn->client->set.rawlog_dir != '\0' && stat(conn->client->set.rawlog_dir, &st) == 0) { - (void)iostream_rawlog_create(conn->client->set.rawlog_dir, - &conn->input, &conn->output); + iostream_rawlog_create(conn->client->set.rawlog_dir, + &conn->input, &conn->output); } imap_parser_set_streams(conn->parser, conn->input, NULL); @@ -1299,8 +1299,8 @@ static void imapc_connection_connect_next_ip(struct imapc_connection *conn) if (*conn->client->set.rawlog_dir != '\0' && conn->client->set.ssl_mode != IMAPC_CLIENT_SSL_MODE_IMMEDIATE && stat(conn->client->set.rawlog_dir, &st) == 0) { - (void)iostream_rawlog_create(conn->client->set.rawlog_dir, - &conn->input, &conn->output); + iostream_rawlog_create(conn->client->set.rawlog_dir, + &conn->input, &conn->output); } o_stream_set_flush_callback(conn->output, imapc_connection_output, diff --git a/src/lib-imap/imap-bodystructure.c b/src/lib-imap/imap-bodystructure.c index cd5a1b66c7..5021016b4a 100644 --- a/src/lib-imap/imap-bodystructure.c +++ b/src/lib-imap/imap-bodystructure.c @@ -64,7 +64,7 @@ static void parse_content_type(struct message_part_body_data *data, /* parse parameters and save them */ str_truncate(str, 0); - (void)rfc2231_parse(&parser, &results); + rfc2231_parse(&parser, &results); for (; *results != NULL; results += 2) { if (strcasecmp(results[0], "charset") == 0) charset_found = TRUE; @@ -122,7 +122,7 @@ static void parse_content_disposition(struct message_part_body_data *data, /* parse parameters and save them */ str_truncate(str, 0); - (void)rfc2231_parse(&parser, &results); + rfc2231_parse(&parser, &results); for (; *results != NULL; results += 2) { str_append_c(str, ' '); imap_quote_append_string(str, results[0], TRUE); diff --git a/src/lib-index/mail-index-strmap.c b/src/lib-index/mail-index-strmap.c index 5bccabcda3..57599618ba 100644 --- a/src/lib-index/mail-index-strmap.c +++ b/src/lib-index/mail-index-strmap.c @@ -403,7 +403,7 @@ mail_index_strmap_uid_exists(struct mail_index_strmap_read_context *ctx, see if it's because the strmap is corrupted or because our current view is a bit stale and the message has already been expunged. */ - (void)mail_index_refresh(ctx->view->view->index); + mail_index_refresh(ctx->view->view->index); if (mail_index_is_expunged(ctx->view->view, ctx->uid_lookup_idx + 1)) ctx->lost_expunged_uid = rec->uid; diff --git a/src/lib-index/mail-index-transaction.c b/src/lib-index/mail-index-transaction.c index fff056f60d..8e635f9d6d 100644 --- a/src/lib-index/mail-index-transaction.c +++ b/src/lib-index/mail-index-transaction.c @@ -98,7 +98,7 @@ void mail_index_transaction_lookup_latest_keywords(struct mail_index_transaction uint32_t uid, latest_seq; if (t->latest_view == NULL) { - (void)mail_index_refresh(t->view->index); + mail_index_refresh(t->view->index); t->latest_view = mail_index_view_open(t->view->index); } mail_index_lookup_uid(t->view, seq, &uid); @@ -210,7 +210,7 @@ static int mail_index_transaction_commit_v(struct mail_index_transaction *t, expunge handlers get run for the newly expunged messages (and sync handlers that require HANDLER_FILE as well). */ index->sync_commit_result = result_r; - (void)mail_index_refresh(index); + mail_index_refresh(index); index->sync_commit_result = NULL; } diff --git a/src/lib-index/mail-index.h b/src/lib-index/mail-index.h index d8a56bd65b..fbc731c292 100644 --- a/src/lib-index/mail-index.h +++ b/src/lib-index/mail-index.h @@ -246,7 +246,8 @@ struct mail_cache *mail_index_get_cache(struct mail_index *index); /* Refresh index so mail_index_lookup*() will return latest values. Note that immediately after this call there may already be changes, so if you need to rely on validity of the returned values, use some external locking for it. */ -int mail_index_refresh(struct mail_index *index); +int ATTR_NOWARN_UNUSED_RESULT +mail_index_refresh(struct mail_index *index); /* View can be used to look into index. Sequence numbers inside view change only when you synchronize it. The view acquires required locks diff --git a/src/lib-index/mail-transaction-log-file.c b/src/lib-index/mail-transaction-log-file.c index f189182fc1..fa5a801b9e 100644 --- a/src/lib-index/mail-transaction-log-file.c +++ b/src/lib-index/mail-transaction-log-file.c @@ -317,7 +317,7 @@ mail_transaction_log_file_undotlock(struct mail_transaction_log_file *file) if (--file->log->dotlock_count > 0) return 0; - ret = file_dotlock_delete_verified(&file->log->dotlock); + ret = file_dotlock_delete(&file->log->dotlock); if (ret < 0) { log_file_set_syscall_error(file, "file_dotlock_delete()"); return -1; diff --git a/src/lib-mail/istream-binary-converter.c b/src/lib-mail/istream-binary-converter.c index ec99b83374..6ca9848b74 100644 --- a/src/lib-mail/istream-binary-converter.c +++ b/src/lib-mail/istream-binary-converter.c @@ -36,14 +36,14 @@ stream_alloc_data(struct binary_converter_istream *bstream, size_t size) struct istream_private *stream = &bstream->istream; size_t old_size, avail_size; - (void)i_stream_get_buffer_space(stream, size, &avail_size); + i_stream_get_buffer_space(stream, size, &avail_size); if (avail_size < size) { old_size = stream->buffer_size; stream->buffer_size = nearest_power(stream->pos + size); stream->w_buffer = i_realloc(stream->w_buffer, old_size, stream->buffer_size); stream->buffer = stream->w_buffer; - (void)i_stream_get_buffer_space(stream, size, &avail_size); + i_stream_get_buffer_space(stream, size, &avail_size); i_assert(avail_size >= size); } return stream->w_buffer + stream->pos; diff --git a/src/lib-mail/message-decoder.c b/src/lib-mail/message-decoder.c index c62fdf2e67..047bff4ee9 100644 --- a/src/lib-mail/message-decoder.c +++ b/src/lib-mail/message-decoder.c @@ -142,7 +142,7 @@ parse_content_type(struct message_decoder_context *ctx, if (rfc822_parse_content_type(&parser, str) <= 0) return; - (void)rfc2231_parse(&parser, &results); + rfc2231_parse(&parser, &results); for (; *results != NULL; results += 2) { if (strcasecmp(results[0], "charset") == 0) { ctx->content_charset = i_strdup(results[1]); diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c index 6bc9d1e7c9..75cbbb3de2 100644 --- a/src/lib-mail/message-parser.c +++ b/src/lib-mail/message-parser.c @@ -487,7 +487,7 @@ static void parse_content_type(struct message_parser_ctx *ctx, ctx->last_boundary != NULL) return; - (void)rfc2231_parse(&parser, &results); + rfc2231_parse(&parser, &results); for (; *results != NULL; results += 2) { if (strcasecmp(results[0], "boundary") == 0) { ctx->last_boundary = diff --git a/src/lib-mail/rfc2231-parser.h b/src/lib-mail/rfc2231-parser.h index 08f53e5941..1c44349880 100644 --- a/src/lib-mail/rfc2231-parser.h +++ b/src/lib-mail/rfc2231-parser.h @@ -5,7 +5,8 @@ them as a NULL-terminated [key, value] array. RFC 2231-style continuations are merged to a single key. Returns -1 if some of the input was invalid (but valid key/value pairs are still returned), 0 if everything looked ok. */ -int rfc2231_parse(struct rfc822_parser_context *ctx, - const char *const **result_r); +int ATTR_NOWARN_UNUSED_RESULT +rfc2231_parse(struct rfc822_parser_context *ctx, + const char *const **result_r); #endif diff --git a/src/lib-storage/index/dbox-multi/mdbox-mail.c b/src/lib-storage/index/dbox-multi/mdbox-mail.c index b4ec186bcd..7a93ca8497 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-mail.c +++ b/src/lib-storage/index/dbox-multi/mdbox-mail.c @@ -60,7 +60,7 @@ static void dbox_mail_set_expunged(struct dbox_mail *mail, uint32_t map_uid) struct mail *_mail = &mail->imail.mail.mail; struct mdbox_mailbox *mbox = (struct mdbox_mailbox *)_mail->box; - (void)mail_index_refresh(_mail->box->index); + mail_index_refresh(_mail->box->index); if (mail_index_is_expunged(_mail->transaction->view, _mail->seq)) { mail_set_expunged(_mail); return; diff --git a/src/lib-storage/index/dbox-single/sdbox-mail.c b/src/lib-storage/index/dbox-single/sdbox-mail.c index 2e0d5bbe1b..69f9a3038a 100644 --- a/src/lib-storage/index/dbox-single/sdbox-mail.c +++ b/src/lib-storage/index/dbox-single/sdbox-mail.c @@ -16,7 +16,7 @@ static void sdbox_mail_set_expunged(struct dbox_mail *mail) { struct mail *_mail = &mail->imail.mail.mail; - (void)mail_index_refresh(_mail->box->index); + mail_index_refresh(_mail->box->index); if (mail_index_is_expunged(_mail->transaction->view, _mail->seq)) { mail_set_expunged(_mail); return; diff --git a/src/lib-storage/index/dbox-single/sdbox-sync.c b/src/lib-storage/index/dbox-single/sdbox-sync.c index fda67c7b86..9b2f0b24cd 100644 --- a/src/lib-storage/index/dbox-single/sdbox-sync.c +++ b/src/lib-storage/index/dbox-single/sdbox-sync.c @@ -170,7 +170,7 @@ sdbox_refresh_header(struct sdbox_mailbox *mbox, bool retry, bool log_error) mail_index_view_close(&view); if (ret < 0 && retry) { - (void)mail_index_refresh(mbox->box.index); + mail_index_refresh(mbox->box.index); return sdbox_refresh_header(mbox, FALSE, log_error); } return ret; diff --git a/src/lib-storage/index/index-storage.c b/src/lib-storage/index/index-storage.c index b9e15cb251..ff398a2b3c 100644 --- a/src/lib-storage/index/index-storage.c +++ b/src/lib-storage/index/index-storage.c @@ -418,7 +418,7 @@ int index_storage_mailbox_update(struct mailbox *box, index_storage_mailbox_update_cache(box, update); /* make sure we get the latest index info */ - (void)mail_index_refresh(box->index); + mail_index_refresh(box->index); view = mail_index_view_open(box->index); hdr = mail_index_get_header(view); @@ -473,7 +473,7 @@ int index_storage_mailbox_delete_dir(struct mailbox *box, bool mailbox_deleted) if (mailbox_list_delete_dir(box->list, box->name) == 0) return 0; - (void)mailbox_list_get_last_error(box->list, &error); + mailbox_list_get_last_error(box->list, &error); if (error != MAIL_ERROR_NOTFOUND || !mailbox_deleted) { mail_storage_copy_list_error(box->storage, box->list); return -1; @@ -517,7 +517,6 @@ int index_storage_mailbox_delete(struct mailbox *box) { struct mailbox_metadata metadata; struct mailbox_status status; - enum mail_error error; int ret_guid; if (!box->opened) { @@ -577,8 +576,7 @@ int index_storage_mailbox_delete(struct mailbox *box) metadata.guid); } if (index_storage_mailbox_delete_dir(box, TRUE) < 0) { - (void)mailbox_get_last_error(box, &error); - if (error != MAIL_ERROR_EXISTS) + if (mailbox_get_last_mail_error(box) != MAIL_ERROR_EXISTS) return -1; /* we deleted the mailbox, but couldn't delete the directory because it has children. that's not an error. */ diff --git a/src/lib-storage/index/index-thread.c b/src/lib-storage/index/index-thread.c index 205769dd4e..5392b0c191 100644 --- a/src/lib-storage/index/index-thread.c +++ b/src/lib-storage/index/index-thread.c @@ -387,9 +387,9 @@ static bool mail_thread_cache_update_removes(struct mail_thread_mailbox *tbox, uids = array_get(&removed_uids, &uid_count); for (i = j = 0; i < uid_count; i++) { /* find and remove from the map */ - (void)bsearch_insert_pos(&uids[i].seq1, &msgid_map[j], - map_count - j, sizeof(*msgid_map), - msgid_map_cmp, &idx); + bsearch_insert_pos(&uids[i].seq1, &msgid_map[j], + map_count - j, sizeof(*msgid_map), + msgid_map_cmp, &idx); j += idx; if (j == map_count) { /* all removals after this are about messages we never diff --git a/src/lib-storage/index/index-transaction.c b/src/lib-storage/index/index-transaction.c index 35c19bb8b1..1fc80600ea 100644 --- a/src/lib-storage/index/index-transaction.c +++ b/src/lib-storage/index/index-transaction.c @@ -107,7 +107,7 @@ void index_transaction_init(struct mailbox_transaction_context *t, itrans_flags = index_transaction_flags_get(flags); if ((flags & MAILBOX_TRANSACTION_FLAG_REFRESH) != 0) - (void)mail_index_refresh(box->index); + mail_index_refresh(box->index); t->box = box; t->itrans = mail_index_transaction_begin(box->view, itrans_flags); diff --git a/src/lib-storage/index/maildir/maildir-mail.c b/src/lib-storage/index/maildir/maildir-mail.c index 6e82c9b9c7..2810a66e8f 100644 --- a/src/lib-storage/index/maildir/maildir-mail.c +++ b/src/lib-storage/index/maildir/maildir-mail.c @@ -201,7 +201,7 @@ maildir_mail_get_fname(struct maildir_mailbox *mbox, struct mail *mail, /* one reason this could happen is if we delayed opening dovecot-uidlist and we're trying to open a mail that got recently expunged. Let's test this theory first: */ - (void)mail_index_refresh(mbox->box.index); + mail_index_refresh(mbox->box.index); view = mail_index_view_open(mbox->box.index); exists = mail_index_lookup_seq(view, mail->uid, &seq); mail_index_view_close(&view); diff --git a/src/lib-storage/index/maildir/maildir-sync.c b/src/lib-storage/index/maildir/maildir-sync.c index b62a7303c7..9bcd089a96 100644 --- a/src/lib-storage/index/maildir/maildir-sync.c +++ b/src/lib-storage/index/maildir/maildir-sync.c @@ -744,7 +744,7 @@ static int maildir_sync_get_changes(struct maildir_sync_context *ctx, if (mbox->synced) { /* refresh index only after the first sync, i.e. avoid wasting time on refreshing it immediately after it was just opened */ - (void)mail_index_refresh(mbox->box.index); + mail_index_refresh(mbox->box.index); } return mail_index_sync_have_any(mbox->box.index, flags) ? 1 : 0; } @@ -999,7 +999,7 @@ int maildir_sync_refresh_flags_view(struct maildir_mailbox *mbox) struct mail_index_view_sync_ctx *sync_ctx; bool delayed_expunges; - (void)mail_index_refresh(mbox->box.index); + mail_index_refresh(mbox->box.index); if (mbox->flags_view == NULL) mbox->flags_view = mail_index_view_open(mbox->box.index); diff --git a/src/lib-storage/index/maildir/maildir-uidlist.c b/src/lib-storage/index/maildir/maildir-uidlist.c index 780bb6ea22..b5555380db 100644 --- a/src/lib-storage/index/maildir/maildir-uidlist.c +++ b/src/lib-storage/index/maildir/maildir-uidlist.c @@ -1335,7 +1335,7 @@ maildir_uidlist_records_drop_expunges(struct maildir_uidlist *uidlist) if (!uidlist->box->opened) return; - (void)mail_index_refresh(uidlist->box->index); + mail_index_refresh(uidlist->box->index); view = mail_index_view_open(uidlist->box->index); count = array_count(&uidlist->records); hdr = mail_index_get_header(view); diff --git a/src/lib-storage/index/mbox/mbox-lock.c b/src/lib-storage/index/mbox/mbox-lock.c index 227755dd52..67af3e2270 100644 --- a/src/lib-storage/index/mbox/mbox-lock.c +++ b/src/lib-storage/index/mbox/mbox-lock.c @@ -86,9 +86,11 @@ static struct mbox_lock_data lock_data[] = { { 0, NULL, NULL } }; -static int mbox_lock_list(struct mbox_lock_context *ctx, int lock_type, - time_t max_wait_time, int idx); -static int mbox_unlock_files(struct mbox_lock_context *ctx); +static int ATTR_NOWARN_UNUSED_RESULT +mbox_lock_list(struct mbox_lock_context *ctx, int lock_type, + time_t max_wait_time, int idx); +static int ATTR_NOWARN_UNUSED_RESULT +mbox_unlock_files(struct mbox_lock_context *ctx); static void mbox_read_lock_methods(const char *str, const char *env, enum mbox_lock_type *locks) @@ -228,7 +230,7 @@ static bool dotlock_callback(unsigned int secs_left, bool stale, void *context) ctx->dotlock_last_stale = TRUE; return FALSE; } - (void)mbox_lock_list(ctx, F_UNLCK, 0, i); + mbox_lock_list(ctx, F_UNLCK, 0, i); } } ctx->dotlock_last_stale = stale; @@ -246,7 +248,7 @@ static bool dotlock_callback(unsigned int secs_left, bool stale, void *context) return TRUE; } -static int ATTR_NULL(2) +static int ATTR_NULL(2) ATTR_NOWARN_UNUSED_RESULT mbox_dotlock_privileged_op(struct mbox_mailbox *mbox, struct dotlock_settings *set, enum mbox_dotlock_op op) @@ -315,7 +317,7 @@ mbox_dotlock_privileged_op(struct mbox_mailbox *mbox, break; case MBOX_DOTLOCK_OP_UNLOCK: /* we're now privileged - avoid doing as much as possible */ - ret = file_dotlock_delete_verified(&mbox->mbox_dotlock); + ret = file_dotlock_delete(&mbox->mbox_dotlock); if (ret < 0) mbox_set_syscall_error(mbox, "file_dotlock_delete()"); mbox->mbox_used_privileges = FALSE; @@ -391,14 +393,14 @@ mbox_lock_dotlock_int(struct mbox_lock_context *ctx, int lock_type, bool try) return 1; if (!mbox->mbox_used_privileges) { - if (file_dotlock_delete_verified(&mbox->mbox_dotlock) <= 0) { + if (file_dotlock_delete(&mbox->mbox_dotlock) <= 0) { mbox_set_syscall_error(mbox, "file_dotlock_delete()"); } } else { ctx->using_privileges = TRUE; - (void)mbox_dotlock_privileged_op(mbox, NULL, - MBOX_DOTLOCK_OP_UNLOCK); + mbox_dotlock_privileged_op(mbox, NULL, + MBOX_DOTLOCK_OP_UNLOCK); ctx->using_privileges = FALSE; } mbox->mbox_dotlocked = FALSE; @@ -666,8 +668,9 @@ static int mbox_lock_fcntl(struct mbox_lock_context *ctx, int lock_type, return 1; } -static int mbox_lock_list(struct mbox_lock_context *ctx, int lock_type, - time_t max_wait_time, int idx) +static int ATTR_NOWARN_UNUSED_RESULT +mbox_lock_list(struct mbox_lock_context *ctx, int lock_type, + time_t max_wait_time, int idx) { enum mbox_lock_type *lock_types; enum mbox_lock_type type; @@ -742,7 +745,7 @@ static int mbox_update_locking(struct mbox_mailbox *mbox, int lock_type, ret = mbox_lock_list(&ctx, lock_type, max_wait_time, 0); if (ret <= 0) { if (!drop_locks) - (void)mbox_unlock_files(&ctx); + mbox_unlock_files(&ctx); if (ret == 0) { mail_storage_set_error(&mbox->storage->storage, MAIL_ERROR_TEMP, MAIL_ERRSTR_LOCK_TIMEOUT); @@ -765,7 +768,7 @@ static int mbox_update_locking(struct mbox_mailbox *mbox, int lock_type, ctx.lock_status[read_locks[i]] = 0; mbox->mbox_lock_type = F_WRLCK; - (void)mbox_lock_list(&ctx, F_UNLCK, 0, 0); + mbox_lock_list(&ctx, F_UNLCK, 0, 0); mbox->mbox_lock_type = F_RDLCK; } @@ -883,7 +886,7 @@ void mbox_dotlock_touch(struct mbox_mailbox *mbox) if (!mbox->mbox_used_privileges) (void)file_dotlock_touch(mbox->mbox_dotlock); else { - (void)mbox_dotlock_privileged_op(mbox, NULL, + mbox_dotlock_privileged_op(mbox, NULL, MBOX_DOTLOCK_OP_TOUCH); } } diff --git a/src/lib-storage/index/mbox/mbox-lock.h b/src/lib-storage/index/mbox/mbox-lock.h index 68b917bc4e..0f8bd1871a 100644 --- a/src/lib-storage/index/mbox/mbox-lock.h +++ b/src/lib-storage/index/mbox/mbox-lock.h @@ -5,7 +5,8 @@ been overwritten (ie. inode has changed), it's reopened. */ int mbox_lock(struct mbox_mailbox *mbox, int lock_type, unsigned int *lock_id_r); -int mbox_unlock(struct mbox_mailbox *mbox, unsigned int lock_id); +int ATTR_NOWARN_UNUSED_RESULT +mbox_unlock(struct mbox_mailbox *mbox, unsigned int lock_id); void mbox_dotlock_touch(struct mbox_mailbox *mbox); diff --git a/src/lib-storage/index/mbox/mbox-mail.c b/src/lib-storage/index/mbox/mbox-mail.c index 89b1f5d6aa..92d58c0489 100644 --- a/src/lib-storage/index/mbox/mbox-mail.c +++ b/src/lib-storage/index/mbox/mbox-mail.c @@ -25,7 +25,7 @@ static void mbox_prepare_resync(struct mail *mail) if (mbox->mbox_lock_type == F_RDLCK) { if (mbox->mbox_lock_id == t->mbox_lock_id) t->mbox_lock_id = 0; - (void)mbox_unlock(mbox, mbox->mbox_lock_id); + mbox_unlock(mbox, mbox->mbox_lock_id); i_assert(mbox->mbox_lock_type == F_UNLCK); } } diff --git a/src/lib-storage/index/mbox/mbox-save.c b/src/lib-storage/index/mbox/mbox-save.c index 85539dd20c..26195b1ad2 100644 --- a/src/lib-storage/index/mbox/mbox-save.c +++ b/src/lib-storage/index/mbox/mbox-save.c @@ -203,7 +203,7 @@ static void mbox_save_init_sync(struct mailbox_transaction_context *t) /* open a new view to get the header. this is required if we just synced the mailbox so we can get updated next_uid. */ - (void)mail_index_refresh(mbox->box.index); + mail_index_refresh(mbox->box.index); view = mail_index_view_open(mbox->box.index); hdr = mail_index_get_header(view); diff --git a/src/lib-storage/index/mbox/mbox-storage.c b/src/lib-storage/index/mbox/mbox-storage.c index 550b77bd00..d955824903 100644 --- a/src/lib-storage/index/mbox/mbox-storage.c +++ b/src/lib-storage/index/mbox/mbox-storage.c @@ -583,7 +583,7 @@ static void mbox_mailbox_close(struct mailbox *box) (void)mbox_sync(mbox, sync_flags); if (mbox->mbox_global_lock_id != 0) - (void)mbox_unlock(mbox, mbox->mbox_global_lock_id); + mbox_unlock(mbox, mbox->mbox_global_lock_id); if (mbox->keep_lock_to != NULL) timeout_remove(&mbox->keep_lock_to); @@ -703,7 +703,7 @@ static void mbox_transaction_unlock(struct mailbox *box, unsigned int lock_id) struct mbox_mailbox *mbox = (struct mbox_mailbox *)box; if (lock_id != 0) - (void)mbox_unlock(mbox, lock_id); + mbox_unlock(mbox, lock_id); if (mbox->mbox_global_lock_id == 0) { i_assert(mbox->box.transaction_count > 0 || mbox->mbox_lock_type == F_UNLCK); diff --git a/src/lib-storage/index/mbox/mbox-sync.c b/src/lib-storage/index/mbox/mbox-sync.c index 89b39b189f..6a3381cb05 100644 --- a/src/lib-storage/index/mbox/mbox-sync.c +++ b/src/lib-storage/index/mbox/mbox-sync.c @@ -1687,7 +1687,7 @@ int mbox_sync_get_guid(struct mbox_mailbox *mbox) mbox_sync_index_update_ext_header(mbox, trans); ret = mail_index_transaction_commit(&trans); } - (void)mbox_unlock(mbox, lock_id); + mbox_unlock(mbox, lock_id); return ret; } @@ -1804,7 +1804,7 @@ static int mbox_sync_int(struct mbox_mailbox *mbox, enum mbox_sync_flags flags, return 0; /* have to sync to make sure offsets have stayed the same */ - (void)mbox_unlock(mbox, *lock_id); + mbox_unlock(mbox, *lock_id); *lock_id = 0; } @@ -1989,7 +1989,7 @@ int mbox_sync(struct mbox_mailbox *mbox, enum mbox_sync_flags flags) if (lock_id != 0) { if (ret < 0) { /* syncing failed, don't leave it locked */ - (void)mbox_unlock(mbox, lock_id); + mbox_unlock(mbox, lock_id); } else if ((flags & MBOX_SYNC_LOCK_READING) == 0) { if (mbox_unlock(mbox, lock_id) < 0) ret = -1; diff --git a/src/lib-storage/index/pop3c/pop3c-client.c b/src/lib-storage/index/pop3c/pop3c-client.c index 7dbb2670a2..23b21dd0a2 100644 --- a/src/lib-storage/index/pop3c/pop3c-client.c +++ b/src/lib-storage/index/pop3c/pop3c-client.c @@ -486,8 +486,8 @@ static int pop3c_client_ssl_init(struct pop3c_client *client) if (*client->set.rawlog_dir != '\0' && stat(client->set.rawlog_dir, &st) == 0) { - (void)iostream_rawlog_create(client->set.rawlog_dir, - &client->input, &client->output); + iostream_rawlog_create(client->set.rawlog_dir, + &client->input, &client->output); } return 0; } @@ -533,8 +533,8 @@ static void pop3c_client_connect_ip(struct pop3c_client *client) if (*client->set.rawlog_dir != '\0' && client->set.ssl_mode != POP3C_CLIENT_SSL_MODE_IMMEDIATE && stat(client->set.rawlog_dir, &st) == 0) { - (void)iostream_rawlog_create(client->set.rawlog_dir, - &client->input, &client->output); + iostream_rawlog_create(client->set.rawlog_dir, + &client->input, &client->output); } client->io = io_add(client->fd, IO_WRITE, pop3c_client_connected, client); diff --git a/src/lib-storage/list/subscription-file.c b/src/lib-storage/list/subscription-file.c index ab321ef06e..8e7022a62a 100644 --- a/src/lib-storage/list/subscription-file.c +++ b/src/lib-storage/list/subscription-file.c @@ -181,7 +181,7 @@ int subsfile_set_subscribed(struct mailbox_list *list, const char *path, o_stream_destroy(&output); if (failed || !changed) { - if (file_dotlock_delete_verified(&dotlock) < 0) { + if (file_dotlock_delete(&dotlock) < 0) { subswrite_set_syscall_error(list, "file_dotlock_delete()", path); failed = TRUE; diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index e72d5ebc7b..6aaa012e7f 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -561,7 +561,7 @@ enum mail_error mailbox_get_last_mail_error(struct mailbox *box) { enum mail_error error; - (void)mail_storage_get_last_error(box->storage, &error); + mail_storage_get_last_error(box->storage, &error); return error; } diff --git a/src/lib-storage/mail-storage.h b/src/lib-storage/mail-storage.h index a14d20f931..6be33f2abd 100644 --- a/src/lib-storage/mail-storage.h +++ b/src/lib-storage/mail-storage.h @@ -374,11 +374,13 @@ void mail_storage_set_callbacks(struct mail_storage *storage, int mail_storage_purge(struct mail_storage *storage); /* Returns the error message of last occurred error. */ -const char *mail_storage_get_last_error(struct mail_storage *storage, - enum mail_error *error_r) ATTR_NULL(2); +const char * ATTR_NOWARN_UNUSED_RESULT +mail_storage_get_last_error(struct mail_storage *storage, + enum mail_error *error_r) ATTR_NULL(2); /* Wrapper for mail_storage_get_last_error(); */ -const char *mailbox_get_last_error(struct mailbox *box, - enum mail_error *error_r) ATTR_NULL(2); +const char * ATTR_NOWARN_UNUSED_RESULT +mailbox_get_last_error(struct mailbox *box, enum mail_error *error_r) + ATTR_NULL(2); /* Wrapper for mail_storage_get_last_error(); */ enum mail_error mailbox_get_last_mail_error(struct mailbox *box); diff --git a/src/lib-storage/mailbox-list.h b/src/lib-storage/mailbox-list.h index a75971e5a4..a2b326fa5e 100644 --- a/src/lib-storage/mailbox-list.h +++ b/src/lib-storage/mailbox-list.h @@ -310,7 +310,8 @@ int mailbox_list_delete_dir(struct mailbox_list *list, const char *name); int mailbox_list_delete_symlink(struct mailbox_list *list, const char *name); /* Returns the error message of last occurred error. */ -const char *mailbox_list_get_last_error(struct mailbox_list *list, - enum mail_error *error_r); +const char * ATTR_NOWARN_UNUSED_RESULT +mailbox_list_get_last_error(struct mailbox_list *list, + enum mail_error *error_r); #endif diff --git a/src/lib-test/test-common.c b/src/lib-test/test-common.c index b25c6f509e..be69d8ff60 100644 --- a/src/lib-test/test-common.c +++ b/src/lib-test/test-common.c @@ -85,7 +85,7 @@ struct istream *test_istream_create_data(const void *data, size_t size) tstream->istream.istream.blocking = FALSE; tstream->istream.istream.seekable = TRUE; - (void)i_stream_create(&tstream->istream, NULL, -1); + i_stream_create(&tstream->istream, NULL, -1); tstream->istream.statbuf.st_size = tstream->max_pos = size; tstream->allow_eof = TRUE; tstream->istream.max_buffer_size = (size_t)-1; diff --git a/src/lib/bsearch-insert-pos.h b/src/lib/bsearch-insert-pos.h index ab051ed2db..0eded217b2 100644 --- a/src/lib/bsearch-insert-pos.h +++ b/src/lib/bsearch-insert-pos.h @@ -23,13 +23,15 @@ /* If key is found, returns TRUE and sets idx_r to the position where the key was found. If key isn't found, returns FALSE and sets idx_r to the position where the key should be inserted. */ -bool bsearch_insert_pos(const void *key, const void *base, unsigned int nmemb, +bool ATTR_NOWARN_UNUSED_RESULT +bsearch_insert_pos(const void *key, const void *base, unsigned int nmemb, size_t size, int (*cmp)(const void *, const void *), unsigned int *idx_r); -bool array_bsearch_insert_pos_i(const struct array *array, const void *key, - int (*cmp)(const void *, const void *), - unsigned int *idx_r); +bool ATTR_NOWARN_UNUSED_RESULT +array_bsearch_insert_pos_i(const struct array *array, const void *key, + int (*cmp)(const void *, const void *), + unsigned int *idx_r); #ifdef CONTEXT_TYPE_SAFETY #define array_bsearch_insert_pos(array, key, cmp, idx_r) \ ({(void)(1 ? 0 : cmp(key, ARRAY_TYPE_CAST_CONST(array)NULL)); \ diff --git a/src/lib/file-dotlock.c b/src/lib/file-dotlock.c index bf6b9cbd07..b5bc57ad62 100644 --- a/src/lib/file-dotlock.c +++ b/src/lib/file-dotlock.c @@ -721,12 +721,7 @@ static bool file_dotlock_has_mtime_changed(time_t t1, time_t t2) return diff > FILE_DOTLOCK_MAX_STAT_MTIME_DIFF; } -void file_dotlock_delete(struct dotlock **dotlock_p) -{ - (void)file_dotlock_delete_verified(dotlock_p); -} - -int file_dotlock_delete_verified(struct dotlock **dotlock_p) +int file_dotlock_delete(struct dotlock **dotlock_p) { struct dotlock *dotlock; const char *lock_path; diff --git a/src/lib/file-dotlock.h b/src/lib/file-dotlock.h index d74032509e..c2e21312bc 100644 --- a/src/lib/file-dotlock.h +++ b/src/lib/file-dotlock.h @@ -58,11 +58,10 @@ int file_dotlock_create(const struct dotlock_settings *set, const char *path, enum dotlock_create_flags flags, struct dotlock **dotlock_r); -/* Delete the dotlock file, ignoring any potential errors. */ -void file_dotlock_delete(struct dotlock **dotlock); /* Delete the dotlock file. Returns 1 if successful, 0 if the file had already been deleted or reused by someone else, -1 if I/O error. */ -int file_dotlock_delete_verified(struct dotlock **dotlock); +int ATTR_NOWARN_UNUSED_RESULT +file_dotlock_delete(struct dotlock **dotlock); /* Use dotlock as the new content for file. This provides read safety without locks, but it's not very good for large files. Returns fd for lock file. diff --git a/src/lib/iostream-rawlog.h b/src/lib/iostream-rawlog.h index 70a5a469a7..08c2759a2b 100644 --- a/src/lib/iostream-rawlog.h +++ b/src/lib/iostream-rawlog.h @@ -1,7 +1,8 @@ #ifndef IOSTREAM_RAWLOG_H #define IOSTREAM_RAWLOG_H -int iostream_rawlog_create(const char *dir, struct istream **input, - struct ostream **output); +int ATTR_NOWARN_UNUSED_RESULT +iostream_rawlog_create(const char *dir, struct istream **input, + struct ostream **output); #endif diff --git a/src/lib/istream-base64-encoder.c b/src/lib/istream-base64-encoder.c index 27957c6a73..2519dc7feb 100644 --- a/src/lib/istream-base64-encoder.c +++ b/src/lib/istream-base64-encoder.c @@ -62,7 +62,7 @@ i_stream_base64_try_encode_line(struct base64_encoder_istream *bstream) bstream->cur_line_len = 0; } - (void)i_stream_get_buffer_space(stream, (size+2)/3*4, &avail); + i_stream_get_buffer_space(stream, (size+2)/3*4, &avail); buffer_avail = stream->buffer_size - stream->pos; if ((size + 2) / 3 * 4 > buffer_avail) { diff --git a/src/lib/istream-data.c b/src/lib/istream-data.c index ca93891df7..f510f6bd4c 100644 --- a/src/lib/istream-data.c +++ b/src/lib/istream-data.c @@ -31,7 +31,7 @@ struct istream *i_stream_create_from_data(const void *data, size_t size) stream->istream.readable_fd = FALSE; stream->istream.blocking = TRUE; stream->istream.seekable = TRUE; - (void)i_stream_create(stream, NULL, -1); + i_stream_create(stream, NULL, -1); stream->statbuf.st_size = size; return &stream->istream; } diff --git a/src/lib/istream-private.h b/src/lib/istream-private.h index abb8c425f7..ac36787712 100644 --- a/src/lib/istream-private.h +++ b/src/lib/istream-private.h @@ -47,14 +47,15 @@ struct istream_private { unsigned int return_nolf_line:1; }; -struct istream * +struct istream * ATTR_NOWARN_UNUSED_RESULT i_stream_create(struct istream_private *stream, struct istream *parent, int fd) ATTR_NULL(2); void i_stream_compress(struct istream_private *stream); void i_stream_grow_buffer(struct istream_private *stream, size_t bytes); -bool i_stream_get_buffer_space(struct istream_private *stream, - size_t wanted_size, size_t *size_r); +bool ATTR_NOWARN_UNUSED_RESULT +i_stream_get_buffer_space(struct istream_private *stream, + size_t wanted_size, size_t *size_r); ssize_t i_stream_read_copy_from_parent(struct istream *istream); void i_stream_default_seek(struct istream_private *stream, uoff_t v_offset, bool mark); diff --git a/src/lib/istream.c b/src/lib/istream.c index a28fd57ae0..bfbf04064a 100644 --- a/src/lib/istream.c +++ b/src/lib/istream.c @@ -521,7 +521,7 @@ bool i_stream_add_data(struct istream *_stream, const unsigned char *data, struct istream_private *stream = _stream->real_stream; size_t size2; - (void)i_stream_get_buffer_space(stream, size, &size2); + i_stream_get_buffer_space(stream, size, &size2); if (size > size2) return FALSE; diff --git a/src/lib/network.h b/src/lib/network.h index 2f5bfb9fcf..d8dde534b9 100644 --- a/src/lib/network.h +++ b/src/lib/network.h @@ -75,7 +75,7 @@ void net_disconnect(int fd); void net_set_nonblock(int fd, bool nonblock); /* Set TCP_CORK if supported, ie. don't send out partial frames. Returns 0 if ok, -1 if failed. */ -int net_set_cork(int fd, bool cork); +int net_set_cork(int fd, bool cork) ATTR_NOWARN_UNUSED_RESULT; /* Set IP to contain INADDR_ANY for IPv4 or IPv6. The IPv6 any address may include IPv4 depending on the system (Linux yes, BSD no). */ diff --git a/src/login-common/client-common-auth.c b/src/login-common/client-common-auth.c index b4e43a73ba..ed0a1f9021 100644 --- a/src/login-common/client-common-auth.c +++ b/src/login-common/client-common-auth.c @@ -574,7 +574,7 @@ sasl_callback(struct client *client, enum sasl_server_reply sasl_reply, return; } - (void)client_unref(&client); + client_unref(&client); } int client_auth_begin(struct client *client, const char *mech_name, diff --git a/src/login-common/client-common.h b/src/login-common/client-common.h index 1596eaa246..1e73edcb38 100644 --- a/src/login-common/client-common.h +++ b/src/login-common/client-common.h @@ -171,7 +171,7 @@ void client_destroy_success(struct client *client, const char *reason); void client_destroy_internal_failure(struct client *client); void client_ref(struct client *client); -bool client_unref(struct client **client); +bool client_unref(struct client **client) ATTR_NOWARN_UNUSED_RESULT; void client_cmd_starttls(struct client *client); diff --git a/src/login-common/login-proxy.c b/src/login-common/login-proxy.c index d6503dc901..8f3a78aacf 100644 --- a/src/login-common/login-proxy.c +++ b/src/login-common/login-proxy.c @@ -383,7 +383,7 @@ login_proxy_free_reason(struct login_proxy **_proxy, const char *reason) i_free(proxy); client->login_proxy = NULL; - (void)client_unref(&client); + client_unref(&client); } void login_proxy_free(struct login_proxy **_proxy) diff --git a/src/login-common/ssl-proxy-gnutls.c b/src/login-common/ssl-proxy-gnutls.c index da76e35247..099fe7e753 100644 --- a/src/login-common/ssl-proxy-gnutls.c +++ b/src/login-common/ssl-proxy-gnutls.c @@ -149,8 +149,8 @@ static int ssl_proxy_destroy(struct ssl_proxy *proxy) if (proxy->io_plain != NULL) io_remove(proxy->io_plain); - (void)net_disconnect(proxy->fd_ssl); - (void)net_disconnect(proxy->fd_plain); + net_disconnect(proxy->fd_ssl); + net_disconnect(proxy->fd_plain); i_free(proxy); diff --git a/src/login-common/ssl-proxy-openssl.c b/src/login-common/ssl-proxy-openssl.c index a25acf1d9f..88de0def03 100644 --- a/src/login-common/ssl-proxy-openssl.c +++ b/src/login-common/ssl-proxy-openssl.c @@ -319,7 +319,7 @@ static void plain_read(struct ssl_proxy *proxy) } if (corked) - (void)net_set_cork(proxy->fd_ssl, FALSE); + net_set_cork(proxy->fd_ssl, FALSE); ssl_proxy_unref(proxy); } @@ -536,9 +536,9 @@ static void ssl_step(struct ssl_proxy *proxy) if (proxy->sslout_size == 0) ssl_set_io(proxy, SSL_REMOVE_OUTPUT); else { - (void)net_set_cork(proxy->fd_ssl, TRUE); + net_set_cork(proxy->fd_ssl, TRUE); ssl_write(proxy); - (void)net_set_cork(proxy->fd_ssl, FALSE); + net_set_cork(proxy->fd_ssl, FALSE); } } @@ -802,11 +802,11 @@ static void ssl_proxy_destroy(struct ssl_proxy *proxy) (void)SSL_shutdown(proxy->ssl); - (void)net_disconnect(proxy->fd_ssl); - (void)net_disconnect(proxy->fd_plain); + net_disconnect(proxy->fd_ssl); + net_disconnect(proxy->fd_plain); if (proxy->client != NULL) - (void)client_unref(&proxy->client); + client_unref(&proxy->client); ssl_proxy_unref(proxy); } diff --git a/src/plugins/fts-lucene/fts-backend-lucene.c b/src/plugins/fts-lucene/fts-backend-lucene.c index 51836aa72c..ef6445b2c4 100644 --- a/src/plugins/fts-lucene/fts-backend-lucene.c +++ b/src/plugins/fts-lucene/fts-backend-lucene.c @@ -198,7 +198,7 @@ fts_backend_lucene_get_last_uid(struct fts_backend *_backend, if (lucene_index_get_last_uid(backend->index, last_uid_r) < 0) return -1; - (void)fts_index_set_last_uid(box, *last_uid_r); + fts_index_set_last_uid(box, *last_uid_r); return 0; } @@ -290,7 +290,7 @@ fts_backend_lucene_update_set_mailbox(struct fts_backend_update_context *_ctx, (struct lucene_fts_backend_update_context *)_ctx; if (ctx->last_uid != 0) { - (void)fts_index_set_last_uid(ctx->box, ctx->last_uid); + fts_index_set_last_uid(ctx->box, ctx->last_uid); ctx->last_uid = 0; } if (ctx->first_box_vname == NULL) diff --git a/src/plugins/fts-solr/fts-backend-solr-old.c b/src/plugins/fts-solr/fts-backend-solr-old.c index 7e713c9984..1527ca84e5 100644 --- a/src/plugins/fts-solr/fts-backend-solr-old.c +++ b/src/plugins/fts-solr/fts-backend-solr-old.c @@ -349,7 +349,7 @@ fts_backend_solr_get_last_uid(struct fts_backend *_backend, if (fts_backend_solr_get_last_uid_fallback(backend, box, last_uid_r) < 0) return -1; - (void)fts_index_set_last_uid(box, *last_uid_r); + fts_index_set_last_uid(box, *last_uid_r); return 0; } @@ -468,7 +468,7 @@ fts_backend_solr_update_set_mailbox(struct fts_backend_update_context *_ctx, struct mail_namespace *ns; if (ctx->prev_uid != 0) { - (void)fts_index_set_last_uid(ctx->cur_box, ctx->prev_uid); + fts_index_set_last_uid(ctx->cur_box, ctx->prev_uid); ctx->prev_uid = 0; } diff --git a/src/plugins/fts-solr/fts-backend-solr.c b/src/plugins/fts-solr/fts-backend-solr.c index 6254b2f689..be5d432177 100644 --- a/src/plugins/fts-solr/fts-backend-solr.c +++ b/src/plugins/fts-solr/fts-backend-solr.c @@ -229,7 +229,7 @@ fts_backend_solr_get_last_uid(struct fts_backend *_backend, if (get_last_uid_fallback(_backend, box, last_uid_r) < 0) return -1; - (void)fts_index_set_last_uid(box, *last_uid_r); + fts_index_set_last_uid(box, *last_uid_r); return 0; } @@ -367,7 +367,7 @@ fts_backend_solr_update_set_mailbox(struct fts_backend_update_context *_ctx, const char *box_guid; if (ctx->prev_uid != 0) { - (void)fts_index_set_last_uid(ctx->cur_box, ctx->prev_uid); + fts_index_set_last_uid(ctx->cur_box, ctx->prev_uid); ctx->prev_uid = 0; } diff --git a/src/plugins/fts/fts-api-private.h b/src/plugins/fts/fts-api-private.h index 05e43f1a49..70d164e84d 100644 --- a/src/plugins/fts/fts-api-private.h +++ b/src/plugins/fts/fts-api-private.h @@ -105,7 +105,8 @@ void fts_filter_uids(ARRAY_TYPE(seq_range) *definite_dest, bool fts_index_get_header(struct mailbox *box, struct fts_index_header *hdr_r); int fts_index_set_header(struct mailbox *box, const struct fts_index_header *hdr); -int fts_index_set_last_uid(struct mailbox *box, uint32_t last_uid); +int ATTR_NOWARN_UNUSED_RESULT +fts_index_set_last_uid(struct mailbox *box, uint32_t last_uid); int fts_index_have_compatible_settings(struct mailbox_list *list, uint32_t checksum); diff --git a/src/plugins/fts/fts-api.c b/src/plugins/fts/fts-api.c index 2109f62b4d..65ff6cdfe1 100644 --- a/src/plugins/fts/fts-api.c +++ b/src/plugins/fts/fts-api.c @@ -343,7 +343,7 @@ bool fts_index_get_header(struct mailbox *box, struct fts_index_header *hdr_r) size_t data_size; bool ret; - (void)mail_index_refresh(box->index); + mail_index_refresh(box->index); view = mail_index_view_open(box->index); mail_index_get_header_ext(view, fts_index_get_ext_id(box), &data, &data_size); diff --git a/src/plugins/fts/fts-parser-script.c b/src/plugins/fts/fts-parser-script.c index bc0631f693..4edc2b50a0 100644 --- a/src/plugins/fts/fts-parser-script.c +++ b/src/plugins/fts/fts-parser-script.c @@ -169,7 +169,7 @@ static void parse_content_disposition(const char *content_disposition, if (rfc822_parse_mime_token(&parser, str) < 0) return; - (void)rfc2231_parse(&parser, &results); + rfc2231_parse(&parser, &results); filename2 = NULL; for (; *results != NULL; results += 2) { if (strcasecmp(results[0], "filename") == 0) { diff --git a/src/plugins/fts/fts-storage.c b/src/plugins/fts/fts-storage.c index 2b390e0c3a..cd11fa6db3 100644 --- a/src/plugins/fts/fts-storage.c +++ b/src/plugins/fts/fts-storage.c @@ -203,7 +203,6 @@ fts_mailbox_search_init(struct mailbox_transaction_context *t, static bool fts_mailbox_build_continue(struct mail_search_context *ctx) { struct fts_search_context *fctx = FTS_CONTEXT(ctx); - enum mail_error error; int ret; ret = fts_indexer_more(fctx->indexer_ctx); @@ -224,8 +223,8 @@ static bool fts_mailbox_build_continue(struct mail_search_context *ctx) if indexing failed for any other reason, just fallback to searching the slow way. */ - (void)mailbox_get_last_error(fctx->box, &error); - fctx->indexing_timed_out = error == MAIL_ERROR_INUSE; + fctx->indexing_timed_out = + mailbox_get_last_mail_error(fctx->box) == MAIL_ERROR_INUSE; } return TRUE; } diff --git a/src/plugins/imap-acl/imap-acl-plugin.c b/src/plugins/imap-acl/imap-acl-plugin.c index 36869a5837..4669998dab 100644 --- a/src/plugins/imap-acl/imap-acl-plugin.c +++ b/src/plugins/imap-acl/imap-acl-plugin.c @@ -687,7 +687,7 @@ void imap_acl_plugin_deinit(void) command_unregister("DELETEACL"); command_unregister("LISTRIGHTS"); - (void)imap_client_created_hook_set(next_hook_client_created); + imap_client_created_hook_set(next_hook_client_created); } const char *imap_acl_plugin_dependencies[] = { "acl", NULL }; diff --git a/src/plugins/imap-quota/imap-quota-plugin.c b/src/plugins/imap-quota/imap-quota-plugin.c index e3b9e79670..a3e4f672e3 100644 --- a/src/plugins/imap-quota/imap-quota-plugin.c +++ b/src/plugins/imap-quota/imap-quota-plugin.c @@ -230,7 +230,7 @@ void imap_quota_plugin_deinit(void) command_unregister("GETQUOTA"); command_unregister("SETQUOTA"); - (void)imap_client_created_hook_set(next_hook_client_created); + imap_client_created_hook_set(next_hook_client_created); } const char *imap_quota_plugin_dependencies[] = { "quota", NULL }; diff --git a/src/plugins/imap-zlib/imap-zlib-plugin.c b/src/plugins/imap-zlib/imap-zlib-plugin.c index c28821bbc8..dfa1f9c53f 100644 --- a/src/plugins/imap-zlib/imap-zlib-plugin.c +++ b/src/plugins/imap-zlib/imap-zlib-plugin.c @@ -153,7 +153,7 @@ void imap_zlib_plugin_deinit(void) { command_unregister("COMPRESS"); - (void)imap_client_created_hook_set(next_hook_client_created); + imap_client_created_hook_set(next_hook_client_created); } const char *imap_zlib_plugin_dependencies[] = { "zlib", NULL }; diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index b414077433..48fe679bce 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -77,7 +77,6 @@ static void client_idle_timeout(struct client *client) static int pop3_mail_get_size(struct client *client, struct mail *mail, uoff_t *size_r) { - enum mail_error error; int ret; if (!client->set->pop3_fast_size_lookups) @@ -90,8 +89,7 @@ pop3_mail_get_size(struct client *client, struct mail *mail, uoff_t *size_r) if (ret == 0) return 0; - (void)mailbox_get_last_error(mail->box, &error); - if (error != MAIL_ERROR_NOTPOSSIBLE) + if (mailbox_get_last_mail_error(mail->box) != MAIL_ERROR_NOTPOSSIBLE) return -1; /* virtual size not available with a fast lookup. @@ -102,8 +100,7 @@ pop3_mail_get_size(struct client *client, struct mail *mail, uoff_t *size_r) if (ret == 0) return 0; - (void)mailbox_get_last_error(mail->box, &error); - if (error != MAIL_ERROR_NOTPOSSIBLE) + if (mailbox_get_last_mail_error(mail->box) != MAIL_ERROR_NOTPOSSIBLE) return -1; /* no way to quickly get the size. fallback to doing a slow virtual