From c3538af440f89c552ca76fbb2ce05dc4be4f3fab Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 28 Nov 2018 13:19:02 +0200 Subject: [PATCH] imap: Cleanup - Change client_enable() to return void Nothing cares about its return value. With the current features it's not even possible to fail. Possibly mailbox_enable() should be also changed to return void in the future. --- src/imap/cmd-enable.c | 2 +- src/imap/cmd-select.c | 2 +- src/imap/cmd-store.c | 3 +-- src/imap/imap-client.c | 7 +++---- src/imap/imap-client.h | 2 +- src/imap/imap-fetch.c | 2 +- src/imap/imap-search.c | 2 +- src/imap/imap-status.c | 2 +- 8 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/imap/cmd-enable.c b/src/imap/cmd-enable.c index 81876973af..904d6db356 100644 --- a/src/imap/cmd-enable.c +++ b/src/imap/cmd-enable.c @@ -22,7 +22,7 @@ bool cmd_enable(struct client_command_context *cmd) return TRUE; } if (imap_feature_lookup(str, &feature_idx)) { - (void)client_enable(cmd->client, feature_idx); + client_enable(cmd->client, feature_idx); str_append_c(reply, ' '); str_append(reply, t_str_ucase(str)); } diff --git a/src/imap/cmd-select.c b/src/imap/cmd-select.c index 9b7c33d218..f17e717730 100644 --- a/src/imap/cmd-select.c +++ b/src/imap/cmd-select.c @@ -409,7 +409,7 @@ bool cmd_select_full(struct client_command_context *cmd, bool readonly) if (ctx->condstore) { /* Enable while no mailbox is opened to avoid sending HIGHESTMODSEQ for previously opened mailbox */ - (void)client_enable(client, imap_feature_condstore); + client_enable(client, imap_feature_condstore); } ret = select_open(ctx, mailbox, readonly); diff --git a/src/imap/cmd-store.c b/src/imap/cmd-store.c index be8ab2b000..126c042b35 100644 --- a/src/imap/cmd-store.c +++ b/src/imap/cmd-store.c @@ -66,8 +66,7 @@ store_parse_modifiers(struct imap_store_context *ctx, "Invalid modseq"); return FALSE; } - (void)client_enable(ctx->cmd->client, - imap_feature_condstore); + client_enable(ctx->cmd->client, imap_feature_condstore); } else { client_send_command_error(ctx->cmd, "Unknown STORE modifier"); diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 6341a99efe..eb2829d9f7 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -1447,7 +1447,7 @@ bool client_handle_search_save_ambiguity(struct client_command_context *cmd) return TRUE; } -int client_enable(struct client *client, unsigned int feature_idx) +void client_enable(struct client *client, unsigned int feature_idx) { enum mailbox_feature features = feature_idx; struct mailbox_status status; @@ -1458,11 +1458,11 @@ int client_enable(struct client *client, unsigned int feature_idx) features |= imap_feature_condstore; if ((client->enabled_features & features) == features) - return 0; + return; client->enabled_features |= features; if (client->mailbox == NULL) - return 0; + return; ret = mailbox_enable(client->mailbox, features); if (ret == 0 && !had_condstore && @@ -1481,7 +1481,6 @@ int client_enable(struct client *client, unsigned int feature_idx) client_send_untagged_storage_error(client, mailbox_get_storage(client->mailbox)); } - return ret; } bool client_has_enabled(struct client *client, unsigned int feature_idx) diff --git a/src/imap/imap-client.h b/src/imap/imap-client.h index dbad74155b..d8ed67734f 100644 --- a/src/imap/imap-client.h +++ b/src/imap/imap-client.h @@ -305,7 +305,7 @@ bool client_read_string_args(struct client_command_context *cmd, have to wait for an existing SEARCH SAVE to finish. */ bool client_handle_search_save_ambiguity(struct client_command_context *cmd); -int client_enable(struct client *client, unsigned int feature_idx); +void client_enable(struct client *client, unsigned int feature_idx); /* Returns TRUE if the given feature is enabled */ bool client_has_enabled(struct client *client, unsigned int feature_idx); /* Returns mailbox features that are currently enabled. */ diff --git a/src/imap/imap-fetch.c b/src/imap/imap-fetch.c index ea5c00c8c9..ed1c51211c 100644 --- a/src/imap/imap-fetch.c +++ b/src/imap/imap-fetch.c @@ -870,7 +870,7 @@ bool imap_fetch_modseq_init(struct imap_fetch_init_context *ctx) ctx->error = "FETCH MODSEQ can't be used with non-permanent modseqs"; return FALSE; } - (void)client_enable(ctx->fetch_ctx->client, imap_feature_condstore); + client_enable(ctx->fetch_ctx->client, imap_feature_condstore); imap_fetch_add_handler(ctx, IMAP_FETCH_HANDLER_FLAG_BUFFERED, NULL, fetch_modseq, NULL); return TRUE; diff --git a/src/imap/imap-search.c b/src/imap/imap-search.c index 521f3adc4d..5a5372fd93 100644 --- a/src/imap/imap-search.c +++ b/src/imap/imap-search.c @@ -576,7 +576,7 @@ bool imap_search_start(struct imap_search_context *ctx, if (ctx->have_modseqs) { ctx->return_options |= SEARCH_RETURN_MODSEQ; - (void)client_enable(cmd->client, imap_feature_condstore); + client_enable(cmd->client, imap_feature_condstore); } ctx->box = cmd->client->mailbox; diff --git a/src/imap/imap-status.c b/src/imap/imap-status.c index 5ab3958346..93a2b372f3 100644 --- a/src/imap/imap-status.c +++ b/src/imap/imap-status.c @@ -79,7 +79,7 @@ int imap_status_get(struct client_command_context *cmd, } if ((items->status & STATUS_HIGHESTMODSEQ) != 0) - (void)client_enable(client, imap_feature_condstore); + client_enable(client, imap_feature_condstore); ret = mailbox_get_status(box, items->status, &result_r->status); if (items->metadata != 0 && ret == 0) { -- 2.47.3