]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission: remove unnecessary casts
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Tue, 12 Dec 2017 17:41:29 +0000 (12:41 -0500)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 13 Dec 2017 10:32:08 +0000 (12:32 +0200)
Casting from a void * to any pointer type is automatic and doesn't
require an explicit cast.

src/submission/cmd-data.c
src/submission/cmd-helo.c
src/submission/cmd-mail.c
src/submission/cmd-noop.c
src/submission/cmd-quit.c
src/submission/cmd-rcpt.c
src/submission/cmd-rset.c
src/submission/cmd-vrfy.c
src/submission/submission-client.c

index 878208f2f0b5821fac31561c7a1d4b6a72295c32..1cb5e49b405d5fa7d21d1f0237f0351728de11a7 100644 (file)
@@ -67,9 +67,8 @@ static void cmd_data_proxy_cb(const struct smtp_reply *proxy_reply,
 int cmd_data_continue(void *conn_ctx, struct smtp_server_cmd_ctx *cmd,
                      struct smtp_server_transaction *trans)
 {
-       struct client *client = (struct client *)conn_ctx;
-       struct cmd_data_context *data_ctx =
-               (struct cmd_data_context *)trans->context;
+       struct client *client = conn_ctx;
+       struct cmd_data_context *data_ctx = trans->context;
        struct istream *data_input = client->state.data_input;
        struct istream *inputs[3];
        string_t *added_headers;
@@ -123,7 +122,7 @@ int cmd_data_begin(void *conn_ctx,
                   struct smtp_server_transaction *trans,
                   struct istream *data_input)
 {
-       struct client *client = (struct client *)conn_ctx;
+       struct client *client = conn_ctx;
        struct cmd_data_context *data_ctx;
        struct istream *inputs[2];
        string_t *path;
@@ -165,8 +164,7 @@ struct cmd_burl_context {
 static void
 cmd_burl_destroy(struct smtp_server_cmd_ctx *cmd)
 {
-       struct cmd_burl_context *burl_cmd =
-               (struct cmd_burl_context *)cmd->context;
+       struct cmd_burl_context *burl_cmd = cmd->context;
 
        if (burl_cmd->urlauth_fetch != NULL)
                imap_urlauth_fetch_deinit(&burl_cmd->urlauth_fetch);
@@ -178,7 +176,7 @@ static int
 cmd_burl_fetch_cb(struct imap_urlauth_fetch_reply *reply,
                  bool last, void *context)
 {
-       struct cmd_burl_context *burl_cmd = (struct cmd_burl_context *)context;
+       struct cmd_burl_context *burl_cmd = context;
        struct smtp_server_cmd_ctx *cmd = burl_cmd->cmd;
        int ret;
 
@@ -290,8 +288,7 @@ cmd_burl_fetch(struct cmd_burl_context *burl_cmd, const char *url,
 void cmd_burl(struct smtp_server_cmd_ctx *cmd, const char *params)
 {
        struct smtp_server_connection *conn = cmd->conn;
-       struct client *client =
-               (struct client *)smtp_server_connection_get_context(conn);
+       struct client *client = smtp_server_connection_get_context(conn);
        struct cmd_burl_context *burl_cmd;
        const char *const *argv;
        enum imap_url_parse_flags url_parse_flags =
@@ -339,7 +336,7 @@ void cmd_burl(struct smtp_server_cmd_ctx *cmd, const char *params)
        burl_cmd->cmd = cmd;
        burl_cmd->chunk_last = chunk_last;
 
-       cmd->context = (void*)burl_cmd;
+       cmd->context = burl_cmd;
        cmd->hook_destroy = cmd_burl_destroy;
 
        if (imap_url->uauth_rumpurl == NULL) {
index 3c3bfc8426aef7f1eeffc37c05e5b1938957ecf8..e1c4990ca2b24857aab02b323c48e5160e6ce14b 100644 (file)
@@ -41,8 +41,7 @@ static void cmd_helo_update_xclient(struct client *client,
 static void cmd_helo_do_reply(struct client *client,
                              struct smtp_server_cmd_ctx *cmd)
 {
-       struct cmd_helo_context *helo =
-               (struct cmd_helo_context *)cmd->context;
+       struct cmd_helo_context *helo = cmd->context;
        enum smtp_capability proxy_caps =
                smtp_client_connection_get_capabilities(client->proxy_conn);
        struct smtp_server_reply *reply;
@@ -97,8 +96,7 @@ static void cmd_helo_do_reply(struct client *client,
 
 static void cmd_helo_reply(struct smtp_server_cmd_ctx *cmd)
 {
-       struct cmd_helo_context *helo =
-               (struct cmd_helo_context *)cmd->context;
+       struct cmd_helo_context *helo = cmd->context;
        struct client *client = helo->client;
 
        /* proxy an XCLIENT command */
@@ -138,8 +136,7 @@ static void cmd_helo_proxy_cb(const struct smtp_reply *proxy_reply,
 
 static void cmd_helo_start(struct smtp_server_cmd_ctx *cmd)
 {
-       struct cmd_helo_context *helo =
-               (struct cmd_helo_context *)cmd->context;
+       struct cmd_helo_context *helo = cmd->context;
        struct client *client = helo->client;
 
        /* proxy an XCLIENT command */
@@ -150,14 +147,14 @@ static void cmd_helo_start(struct smtp_server_cmd_ctx *cmd)
 int cmd_helo(void *conn_ctx, struct smtp_server_cmd_ctx *cmd,
             struct smtp_server_cmd_helo *data)
 {
-       struct client *client = (struct client *)conn_ctx;
+       struct client *client = conn_ctx;
        struct cmd_helo_context *helo;
 
        helo = p_new(cmd->pool, struct cmd_helo_context, 1);
        helo->client = client;
        helo->cmd = cmd;
        helo->data = data;
-       cmd->context = (void*)helo;
+       cmd->context = helo;
 
        if (!client_proxy_is_ready(client)) {
                if (client_proxy_is_disconnected(client)) {
index 9b62d18cd43acddf260888223f1a8badf40252f5..c14b12d4563774e1afae41c689cf74c5c4913240 100644 (file)
@@ -46,8 +46,7 @@ static void cmd_mail_update_xclient(struct client *client)
 
 static void cmd_mail_replied(struct smtp_server_cmd_ctx *cmd)
 {
-       struct cmd_mail_context *mail_cmd =
-               (struct cmd_mail_context *)cmd->context;
+       struct cmd_mail_context *mail_cmd = cmd->context;
 
        if (mail_cmd->cmd_proxied != NULL)
                smtp_client_command_abort(&mail_cmd->cmd_proxied);
@@ -133,7 +132,7 @@ cmd_mail_parameter_size(struct client *client,
 int cmd_mail(void *conn_ctx, struct smtp_server_cmd_ctx *cmd,
             struct smtp_server_cmd_mail *data)
 {
-       struct client *client = (struct client *)conn_ctx;
+       struct client *client = conn_ctx;
        struct cmd_mail_context *mail_cmd;
        enum smtp_capability proxy_caps =
                smtp_client_connection_get_capabilities(client->proxy_conn);
@@ -152,7 +151,7 @@ int cmd_mail(void *conn_ctx, struct smtp_server_cmd_ctx *cmd,
        mail_cmd->data = data;
        mail_cmd->client = client;
 
-       cmd->context = (void*)mail_cmd;
+       cmd->context = mail_cmd;
        cmd->hook_replied = cmd_mail_replied;
        mail_cmd->cmd_proxied = smtp_client_command_mail_submit(
                client->proxy_conn, 0, data->path, &data->params,
index 0ede6db319f074935be259a194096efcbf2f7dac..ffa095139d35c38bddece77ec4a4359d4937c731 100644 (file)
@@ -35,13 +35,13 @@ static void cmd_noop_proxy_cb(const struct smtp_reply *proxy_reply,
 
 int cmd_noop(void *conn_ctx, struct smtp_server_cmd_ctx *cmd)
 {
-       struct client *client = (struct client *)conn_ctx;
+       struct client *client = conn_ctx;
        struct cmd_noop_context *noop_cmd;
 
        noop_cmd = p_new(cmd->pool, struct cmd_noop_context, 1);
        noop_cmd->client = client;
        noop_cmd->cmd = cmd;
-       cmd->context = (void*)noop_cmd;
+       cmd->context = noop_cmd;
 
        noop_cmd->cmd_proxied = smtp_client_command_noop_submit
                (client->proxy_conn, 0, cmd_noop_proxy_cb, noop_cmd);
index 78904df62a590e41f03ebfb6d4afb252297c1a5a..114226d4f399e80ea6afc466c3d3a69904c501df 100644 (file)
@@ -27,13 +27,13 @@ static void cmd_quit_proxy_cb(
 
 int cmd_quit(void *conn_ctx, struct smtp_server_cmd_ctx *cmd)
 {
-       struct client *client = (struct client *)conn_ctx;
+       struct client *client = conn_ctx;
        struct cmd_quit_context *quit_cmd;
 
        quit_cmd = p_new(cmd->pool, struct cmd_quit_context, 1);
        quit_cmd->client = client;
        quit_cmd->cmd = cmd;
-       cmd->context = (void*)quit_cmd;
+       cmd->context = quit_cmd;
 
        quit_cmd->cmd_proxied = smtp_client_command_new
                (client->proxy_conn, 0, cmd_quit_proxy_cb, quit_cmd);
index a96558298381b29f4ef1051f678a1febefd57e33..e8bd5eb43ce5dcc5691bae899e3c443d959f4404 100644 (file)
@@ -25,8 +25,7 @@ struct cmd_rcpt_context {
 
 static void cmd_rcpt_replied(struct smtp_server_cmd_ctx *cmd)
 {
-       struct cmd_rcpt_context *rcpt_cmd =
-               (struct cmd_rcpt_context *)cmd->context;
+       struct cmd_rcpt_context *rcpt_cmd = cmd->context;
 
        if (rcpt_cmd->cmd_proxied != NULL)
                smtp_client_command_abort(&rcpt_cmd->cmd_proxied);
@@ -59,7 +58,7 @@ static void cmd_rcpt_proxy_cb(const struct smtp_reply *proxy_reply,
 int cmd_rcpt(void *conn_ctx, struct smtp_server_cmd_ctx *cmd,
             struct smtp_server_cmd_rcpt *data)
 {
-       struct client *client = (struct client *)conn_ctx;
+       struct client *client = conn_ctx;
        struct cmd_rcpt_context *rcpt_cmd;
 
        /* queue command (pipeline) */
@@ -68,7 +67,7 @@ int cmd_rcpt(void *conn_ctx, struct smtp_server_cmd_ctx *cmd,
        rcpt_cmd->data = data;
        rcpt_cmd->client = client;
 
-       cmd->context = (void*)rcpt_cmd;
+       cmd->context = rcpt_cmd;
        cmd->hook_replied = cmd_rcpt_replied;
        rcpt_cmd->cmd_proxied = smtp_client_command_rcpt_submit(
                client->proxy_conn, 0, data->path, &data->params,
index 578851c864dd8a481b360be84b84ca98c6099b94..6df6743fcbf74aace05e315bca401f32d28d8c91 100644 (file)
@@ -37,14 +37,14 @@ static void cmd_rset_proxy_cb(const struct smtp_reply *proxy_reply,
 
 int cmd_rset(void *conn_ctx, struct smtp_server_cmd_ctx *cmd)
 {
-       struct client *client = (struct client *)conn_ctx;
+       struct client *client = conn_ctx;
        struct cmd_rset_context *rset_cmd;
 
        rset_cmd = p_new(cmd->pool, struct cmd_rset_context, 1);
        rset_cmd->cmd = cmd;
        rset_cmd->client = client;
 
-       cmd->context = (void*)rset_cmd;
+       cmd->context = rset_cmd;
        rset_cmd->cmd_proxied = smtp_client_command_rset_submit
                (client->proxy_conn, 0, cmd_rset_proxy_cb, rset_cmd);
        return 0;
index ca3e554d710f108cca3472906ed463648680dca4..95b2644b8ba6be07eface2373e8054cabd036b3e 100644 (file)
@@ -45,13 +45,13 @@ static void cmd_vrfy_proxy_cb(const struct smtp_reply *proxy_reply,
 int cmd_vrfy(void *conn_ctx, struct smtp_server_cmd_ctx *cmd,
             const char *param)
 {
-       struct client *client = (struct client *)conn_ctx;
+       struct client *client = conn_ctx;
        struct cmd_vrfy_context *vrfy_cmd;
 
        vrfy_cmd = p_new(cmd->pool, struct cmd_vrfy_context, 1);
        vrfy_cmd->client = client;
        vrfy_cmd->cmd = cmd;
-       cmd->context = (void*)vrfy_cmd;
+       cmd->context = vrfy_cmd;
 
        vrfy_cmd->cmd_proxied = smtp_client_command_vrfy_submit(
                client->proxy_conn, 0, param, cmd_vrfy_proxy_cb, vrfy_cmd);
index 79de3cc0552618e12c4e56828249b5a6a0a8193a..af0c6afd48df0eae3ea1e2339acb73ac20a7452f 100644 (file)
@@ -49,14 +49,14 @@ static const struct smtp_server_callbacks smtp_callbacks;
 /* try to proxy pipelined commands in a similarly pipelined fashion */
 static void client_input_pre(void *context)
 {
-       struct client *client = (struct client *)context;
+       struct client *client = context;
 
        if (client->proxy_conn != NULL)
                smtp_client_connection_cork(client->proxy_conn);
 }
 static void client_input_post(void *context)
 {
-       struct client *client = (struct client *)context;
+       struct client *client = context;
 
        if (client->proxy_conn != NULL)
                smtp_client_connection_uncork(client->proxy_conn);
@@ -76,7 +76,7 @@ static const char *client_remote_id(struct client *client)
 static void client_proxy_ready_cb(const struct smtp_reply *reply,
                                  void *context)
 {
-       struct client *client = (struct client *)context;
+       struct client *client = context;
        enum smtp_capability caps;
 
        /* check proxy status */
@@ -282,7 +282,7 @@ static void
 client_connection_trans_free(void *context,
                             struct smtp_server_transaction *trans ATTR_UNUSED)
 {
-       struct client *client = (struct client *)context;
+       struct client *client = context;
 
        client_state_reset(client);
 }
@@ -297,7 +297,7 @@ client_connection_state_changed(void *context ATTR_UNUSED,
 
 static void client_connection_disconnect(void *context, const char *reason)
 {
-       struct client *client = (struct client *)context;
+       struct client *client = context;
        struct smtp_server_connection *conn = client->conn;
        const struct smtp_server_stats *stats;
 
@@ -311,7 +311,7 @@ static void client_connection_disconnect(void *context, const char *reason)
 
 static void client_connection_destroy(void *context)
 {
-       struct client *client = (struct client *)context;
+       struct client *client = context;
 
        client_destroy(client, NULL, NULL);
 }