]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: start relying on io_remove{,_closed}(NULL) being a no-op
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Tue, 6 Jun 2017 09:28:07 +0000 (12:28 +0300)
committerJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Wed, 20 Sep 2017 09:29:06 +0000 (12:29 +0300)
Cleanup performed with the following semantic patch:

@@
expression E;
@@

- if (E != NULL) {
-  io_remove(&E);
- }
+ io_remove(&E);

@@
expression E;
@@

- if (E != NULL) {
-  io_remove_closed(&E);
- }
+ io_remove_closed(&E);

63 files changed:
src/anvil/main.c
src/auth/auth-client-connection.c
src/auth/auth-master-connection.c
src/auth/auth-postfix-connection.c
src/auth/auth-worker-client.c
src/auth/auth-worker-server.c
src/auth/db-checkpassword.c
src/auth/db-ldap.c
src/dict/dict-connection.c
src/director/director-connection.c
src/director/director-test.c
src/doveadm/client-connection.c
src/doveadm/doveadm-dsync.c
src/doveadm/dsync/dsync-ibc-stream.c
src/doveadm/server-connection.c
src/imap-hibernate/imap-client.c
src/imap-urlauth/imap-urlauth-client.c
src/imap-urlauth/imap-urlauth-worker.c
src/imap/cmd-append.c
src/imap/cmd-idle.c
src/imap/imap-client.c
src/ipc/client.c
src/lib-auth/auth-server-connection.c
src/lib-dns/dns-lookup.c
src/lib-http/http-client-connection.c
src/lib-http/http-client-request.c
src/lib-http/http-server-connection.c
src/lib-http/http-server-response.c
src/lib-http/test-http-payload.c
src/lib-http/test-http-server-errors.c
src/lib-imap-client/imapc-connection.c
src/lib-master/master-auth.c
src/lib-master/master-login-auth.c
src/lib-master/master-login.c
src/lib-master/master-service-haproxy.c
src/lib-master/master-service.c
src/lib-program-client/program-client.c
src/lib-program-client/test-program-client-net.c
src/lib-program-client/test-program-client-unix.c
src/lib-smtp/lmtp-client.c
src/lib-sql/driver-cassandra.c
src/lib-storage/index/pop3c/pop3c-client.c
src/lib-storage/list/mailbox-list-index-notify.c
src/lib-storage/mailbox-watch.c
src/lib/connection.c
src/lib/ioloop-notify-inotify.c
src/lib/ioloop-notify-kqueue.c
src/lib/iostream-pump.c
src/lib/ostream-file.c
src/lmtp/client.c
src/log/log-connection.c
src/login-common/client-common-auth.c
src/login-common/client-common.c
src/login-common/login-proxy.c
src/login-common/main.c
src/login-common/ssl-proxy-openssl.c
src/master/service-monitor.c
src/master/service-process-notify.c
src/plugins/fts/fts-parser-tika.c
src/pop3/pop3-client.c
src/stats/client.c
src/stats/stats-carbon.c
src/util/rawlog.c

index fd99680a7e6858f43f9b405bd3e7bdeea83adaf6..dc9ca2378f6d9203c1b55b33a798616792b4c59a 100644 (file)
@@ -80,8 +80,7 @@ int main(int argc, char *argv[])
 
        master_service_run(master_service, client_connected);
 
-       if (log_fdpass_io != NULL)
-               io_remove(&log_fdpass_io);
+       io_remove(&log_fdpass_io);
        penalty_deinit(&penalty);
        connect_limit_deinit(&connect_limit);
        anvil_connections_destroy_all();
index cfa0073f35a30b96ac1e7e1e1090ae8b7f64be31..a05327fb927b526cd38f29b9a1bb0f55857a7562 100644 (file)
@@ -76,8 +76,7 @@ static void auth_client_send(struct auth_client_connection *conn,
            OUTBUF_THROTTLE_SIZE) {
                /* stop reading new requests until client has read the pending
                   replies. */
-               if (conn->io != NULL)
-                       io_remove(&conn->io);
+               io_remove(&conn->io);
        }
 
        if (conn->auth->set->debug) {
@@ -371,8 +370,7 @@ void auth_client_connection_destroy(struct auth_client_connection **_conn)
        i_stream_close(conn->input);
        o_stream_close(conn->output);
 
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
 
        net_disconnect(conn->fd);
        conn->fd = -1;
index a9de7c44737adb5e97bd28e01d0fbe6ec07d1415..eadc8431c35943c9c19accb2f046f7ab638de927 100644 (file)
@@ -786,8 +786,7 @@ void auth_master_connection_destroy(struct auth_master_connection **_conn)
                i_stream_close(conn->input);
        if (conn->output != NULL)
                o_stream_close(conn->output);
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        if (conn->fd != -1) {
                if (close(conn->fd) < 0)
                        i_error("close(%s): %m", conn->path);
index ad30ed7cda058eed478f117023dba6ca88652f4a..18592e5536c150d4c9a75a8f6c21e7e4596e7612 100644 (file)
@@ -200,8 +200,7 @@ auth_postfix_connection_destroy(struct auth_postfix_connection **_conn)
                i_stream_close(conn->input);
        if (conn->output != NULL)
                o_stream_close(conn->output);
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        if (conn->fd != -1) {
                if (close(conn->fd) < 0)
                        i_error("close(%s): %m", conn->path);
index 7b182ad32939fac8d5e3d5137e8f61c926063cdd..4fa775b7eb41794d3c6f8e9d7cec8dac75575d1d 100644 (file)
@@ -71,8 +71,7 @@ auth_worker_client_check_throttle(struct auth_worker_client *client)
            OUTBUF_THROTTLE_SIZE) {
                /* stop reading new requests until client has read the pending
                   replies. */
-               if (client->io != NULL)
-                       io_remove(&client->io);
+               io_remove(&client->io);
        }
 }
 
@@ -790,8 +789,7 @@ void auth_worker_client_destroy(struct auth_worker_client **_client)
 
        if (client->to_idle != NULL)
                timeout_remove(&client->to_idle);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
 
        net_disconnect(client->fd);
        client->fd = -1;
index 318fa913e69c344073fc9f2e5e98e6044c7ddcab..be905cf4bb30c8821d9bff290a0781925e007974 100644 (file)
@@ -240,8 +240,7 @@ static void auth_worker_destroy(struct auth_worker_connection **_conn,
                                conn->request->context);
        }
 
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        i_stream_destroy(&conn->input);
        o_stream_destroy(&conn->output);
        if (conn->to != NULL)
index 8b60c00dc0ddb9706847e37d478c6c2557dc1821..1f2ebb03ae42873337119e5f77de33783c11b842 100644 (file)
@@ -63,10 +63,8 @@ env_put_extra_fields(const ARRAY_TYPE(auth_field) *extra_fields)
 
 static void checkpassword_request_close(struct chkpw_auth_request *request)
 {
-       if (request->io_in != NULL)
-               io_remove(&request->io_in);
-       if (request->io_out != NULL)
-               io_remove(&request->io_out);
+       io_remove(&request->io_in);
+       io_remove(&request->io_out);
 
        if (request->fd_in != -1) {
                if (close(request->fd_in) < 0)
index 69f772be5a20f109f494697ca6bdb3f2ba7d6360..5bf9fa4b56db74e396b97ac506c60a313cbd9525 100644 (file)
@@ -1287,8 +1287,7 @@ void db_ldap_connect_delayed(struct ldap_connection *conn)
 void db_ldap_enable_input(struct ldap_connection *conn, bool enable)
 {
        if (!enable) {
-               if (conn->io != NULL)
-                       io_remove(&conn->io);
+               io_remove(&conn->io);
        } else {
                if (conn->io == NULL && conn->fd != -1) {
                        conn->io = io_add(conn->fd, IO_READ, ldap_input, conn);
@@ -1338,11 +1337,9 @@ static void db_ldap_conn_close(struct ldap_connection *conn)
        }
        conn->fd = -1;
 
-       if (conn->io != NULL) {
-               /* the fd may have already been closed before ldap_unbind(),
-                  so we'll have to use io_remove_closed(). */
-               io_remove_closed(&conn->io);
-       }
+       /* the fd may have already been closed before ldap_unbind(),
+          so we'll have to use io_remove_closed(). */
+       io_remove_closed(&conn->io);
 
        if (aqueue_count(conn->request_queue) > 0) {
                conn->to = timeout_add(DB_LDAP_REQUEST_DISCONNECT_TIMEOUT_SECS *
index ac8e34e7f1c035ab78113882fc136dc58444d658..e171adab1ea2f6dd0d14c8f90332ebd10075cdeb 100644 (file)
@@ -291,8 +291,7 @@ void dict_connection_destroy(struct dict_connection *conn)
 
        if (conn->to_input != NULL)
                timeout_remove(&conn->to_input);
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        i_stream_close(conn->input);
        o_stream_close(conn->output);
        if (close(conn->fd) < 0)
index f01b031f543cb7ee81df8d8e017ce711ae6f4d06..40f1eb5dd6675e1448bdc1d1f8438d7a3f3596e8 100644 (file)
@@ -2191,8 +2191,7 @@ void director_connection_deinit(struct director_connection **_conn,
        if (conn->to_pong != NULL)
                timeout_remove(&conn->to_pong);
        timeout_remove(&conn->to_ping);
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        i_stream_unref(&conn->input);
        o_stream_unref(&conn->output);
        if (close(conn->fd) < 0)
index b43a3138197522656ed3be08ee3782eef0dcf932..fb9428bc84c072228de8430866e3d77bca6b51f0 100644 (file)
@@ -370,14 +370,12 @@ static void director_connection_destroy(struct director_connection **_conn)
        if (conn->to_delay != NULL)
                timeout_remove(&conn->to_delay);
 
-       if (conn->in_io != NULL)
-               io_remove(&conn->in_io);
+       io_remove(&conn->in_io);
        i_stream_unref(&conn->in_input);
        o_stream_unref(&conn->in_output);
        net_disconnect(conn->in_fd);
 
-       if (conn->out_io != NULL)
-               io_remove(&conn->out_io);
+       io_remove(&conn->out_io);
        i_stream_unref(&conn->out_input);
        o_stream_unref(&conn->out_output);
        net_disconnect(conn->out_fd);
index 3deca328d6f5f5c987294390205c76818712b66c..d6f7d4a432dcebbd61424a2e2aab3d7b1b0cf4f9 100644 (file)
@@ -570,9 +570,7 @@ void client_connection_destroy(struct client_connection **_conn)
        if (conn->output != NULL)
                o_stream_destroy(&conn->output);
 
-       if (conn->io != NULL) {
-               io_remove(&conn->io);
-       }
+       io_remove(&conn->io);
 
        if (conn->input != NULL) {
                i_stream_destroy(&conn->input);
index 3235e65dadf2b8b1b583ba7d035385d59b6fe9c0..3db44c59366c8985b3fe0455481cbd46a555c12b 100644 (file)
@@ -126,8 +126,7 @@ static void remote_error_input(struct dsync_cmd_context *ctx)
                i_stream_skip(ctx->err_stream, size);
                break;
        case -1:
-               if (ctx->io_err != NULL)
-                       io_remove(&ctx->io_err);
+               io_remove(&ctx->io_err);
                break;
        default:
                while ((line = i_stream_next_line(ctx->err_stream)) != NULL)
@@ -733,8 +732,7 @@ cmd_dsync_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user)
        } else {
                i_assert(ctx->err_stream == NULL);
        }
-       if (ctx->io_err != NULL)
-               io_remove(&ctx->io_err);
+       io_remove(&ctx->io_err);
        i_close_fd(&ctx->fd_err);
 
        if (ctx->child_wait != NULL)
index 878013821f92b7bac9c44729174c72562b511c69..454c7bbc4dc765fb2b4c229216751f7b1fd05594 100644 (file)
@@ -388,8 +388,7 @@ static void dsync_ibc_stream_deinit(struct dsync_ibc *_ibc)
        }
 
        timeout_remove(&ibc->to);
-       if (ibc->io != NULL)
-               io_remove(&ibc->io);
+       io_remove(&ibc->io);
        i_stream_destroy(&ibc->input);
        o_stream_destroy(&ibc->output);
        pool_unref(&ibc->ret_pool);
index 3d953fd50430cb3c8214d3f3d02541e2af6c910f..e3bbd58f752ac24fa66b1acbe627aa99480b0562 100644 (file)
@@ -564,8 +564,7 @@ void server_connection_destroy(struct server_connection **_conn)
                o_stream_destroy(&conn->cmd_output);
        if (conn->ssl_iostream != NULL)
                ssl_iostream_unref(&conn->ssl_iostream);
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        if (conn->fd != -1) {
                if (close(conn->fd) < 0)
                        i_error("close(server) failed: %m");
@@ -618,7 +617,6 @@ void server_connection_extract(struct server_connection *conn,
        conn->input = NULL;
        conn->output = NULL;
        conn->ssl_iostream = NULL;
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        conn->fd = -1;
 }
index 6b770ba3fc0549ffa7829657c87b6c32860bb208..f61f8666aae9160522c4e6650a9c19506997f3a5 100644 (file)
@@ -586,14 +586,12 @@ static void imap_client_stop(struct imap_client *client)
 
        if (client->unhibernate_queued)
                priorityq_remove(unhibernate_queue, &client->item);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        if (client->to_keepalive != NULL)
                timeout_remove(&client->to_keepalive);
 
        array_foreach_modifiable(&client->notifys, notify) {
-               if (notify->io != NULL)
-                       io_remove(&notify->io);
+               io_remove(&notify->io);
                i_close_fd(&notify->fd);
        }
 }
index a7dc1ac2585b0632f728ba583f6e685d524ee4ca..5fbe3cff213dcde162cef0601e547b14a5a1d321 100644 (file)
@@ -191,8 +191,7 @@ void client_worker_disconnect(struct client *client)
 {
        client->worker_state = IMAP_URLAUTH_WORKER_STATE_INACTIVE;
 
-       if (client->ctrl_io != NULL)
-               io_remove(&client->ctrl_io);
+       io_remove(&client->ctrl_io);
        if (client->ctrl_output != NULL)
                o_stream_destroy(&client->ctrl_output);
        if (client->ctrl_input != NULL)
index 3036cbed6de74683fc49c11fbc59ef867caebdf1..b5f60e1aa074343403385297d8da8dfa2ffd6cfb 100644 (file)
@@ -238,10 +238,8 @@ static void client_destroy(struct client *client)
        if (client->mail_user != NULL)
                mail_user_unref(&client->mail_user);
 
-       if (client->io != NULL)
-               io_remove(&client->io);
-       if (client->ctrl_io != NULL)
-               io_remove(&client->ctrl_io);
+       io_remove(&client->io);
+       io_remove(&client->ctrl_io);
        if (client->to_idle != NULL)
                timeout_remove(&client->to_idle);
 
index e9943c264b026ce8829a1dab8ba0c50787670486..d9d2037d3b787b9e45404ddfc89c463e9450cba0 100644 (file)
@@ -134,8 +134,7 @@ static void cmd_append_finish(struct cmd_append_context *ctx)
 
        i_assert(ctx->client->input_lock == ctx->cmd);
 
-       if (ctx->client->io != NULL)
-               io_remove(&ctx->client->io);
+       io_remove(&ctx->client->io);
        /* we must put back the original flush callback before beginning to
           sync (the command is still unfinished at that point) */
        o_stream_set_flush_callback(ctx->client->output,
index bdb733a3e880c38a662ddb697594b3526718500f..092bc83b34044e750d6d1fc2922f6cdbd329fdd0 100644 (file)
@@ -39,8 +39,7 @@ idle_finish(struct cmd_idle_context *ctx, bool done_ok, bool free_cmd)
        }
 
        o_stream_cork(client->output);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
 
        if (client->mailbox != NULL)
                mailbox_notify_changes_stop(client->mailbox);
index 699a2aa104c64e85bfa4d113645dade3f5b1d115..0efc4e9cc8dcf06ad7fd54a21feb964780d86a17 100644 (file)
@@ -432,8 +432,7 @@ static void client_default_destroy(struct client *client, const char *reason)
 
        if (client->free_parser != NULL)
                imap_parser_unref(&client->free_parser);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        if (client->to_idle_output != NULL)
                timeout_remove(&client->to_idle_output);
        if (client->to_delayed_input != NULL)
index 47fa168ec2bdb2c50f90155453bc040a071b8d4e..14f0e71697af7366d8093657839ac6a2cf2c2df1 100644 (file)
@@ -137,8 +137,7 @@ void client_destroy(struct client **_client)
        *_client = NULL;
 
        DLLIST_REMOVE(&clients, client);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        i_stream_destroy(&client->input);
        o_stream_destroy(&client->output);
        if (close(client->fd) < 0)
index a313888d956202cd8cbf7bb13d5746e538479502..71d2df1550f7524c549dc6a6a4f1042081844c41 100644 (file)
@@ -359,8 +359,7 @@ void auth_server_connection_disconnect(struct auth_server_connection *conn,
 
        if (conn->to != NULL)
                timeout_remove(&conn->to);
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        if (conn->fd != -1) {
                i_stream_destroy(&conn->input);
                o_stream_destroy(&conn->output);
index 0b51bdfa99a675c5205d851928eee4f92c204c8d..3866dfa1f5f5636345748499d545529cb6062795 100644 (file)
@@ -61,8 +61,7 @@ static void dns_client_disconnect(struct dns_client *client, const char *error)
 
        if (client->to_idle != NULL)
                timeout_remove(&client->to_idle);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        if (client->input != NULL)
                i_stream_destroy(&client->input);
        if (client->fd != -1) {
index 181bb2f12694c301b5d4b9bc994704255e3f9c74..814de2b40f5114d24b6938436d6b045ec88093b4 100644 (file)
@@ -1546,8 +1546,7 @@ http_client_connection_disconnect(struct http_client_connection *conn)
        if (conn->connect_initialized)
                connection_disconnect(&conn->conn);
 
-       if (conn->io_req_payload != NULL)
-               io_remove(&conn->io_req_payload);
+       io_remove(&conn->io_req_payload);
        if (conn->to_requests != NULL)
                timeout_remove(&conn->to_requests);
        if (conn->to_connect != NULL)
index 21c0a90917ad430e3b4ff91ccc112a24a9c2dff1..4dadbcb26e3799ec961549d4a60758f7a0b6ae4e 100644 (file)
@@ -1008,8 +1008,7 @@ static void http_client_request_payload_input(struct http_client_request *req)
 {      
        struct http_client_connection *conn = req->conn;
 
-       if (conn->io_req_payload != NULL)
-               io_remove(&conn->io_req_payload);
+       io_remove(&conn->io_req_payload);
 
        (void)http_client_connection_output(conn);
 }
@@ -1024,8 +1023,7 @@ int http_client_request_send_more(struct http_client_request *req,
        i_assert(req->payload_input != NULL);
        i_assert(req->payload_output != NULL);
 
-       if (conn->io_req_payload != NULL)
-               io_remove(&conn->io_req_payload);
+       io_remove(&conn->io_req_payload);
 
        /* chunked ostream needs to write to the parent stream's buffer */
        o_stream_set_max_buffer_size(output, IO_BLOCK_SIZE);
index 707939f9251e435659f35d2426663fc44c217224..c471b096bdb7a09416b004acb54e53c085481f02 100644 (file)
@@ -107,8 +107,7 @@ http_server_connection_get_stats(struct http_server_connection *conn)
 static void
 http_server_connection_input_halt(struct http_server_connection *conn)
 {
-       if (conn->conn.io != NULL)
-               io_remove(&conn->conn.io);
+       io_remove(&conn->conn.io);
 }
 
 static void
@@ -1169,8 +1168,7 @@ http_server_connection_disconnect(struct http_server_connection *conn,
                timeout_remove(&conn->to_input);
 
        http_server_connection_timeout_stop(conn);
-       if (conn->io_resp_payload != NULL)
-               io_remove(&conn->io_resp_payload);
+       io_remove(&conn->io_resp_payload);
        if (conn->conn.output != NULL) {
                o_stream_nflush(conn->conn.output);
                o_stream_uncork(conn->conn.output);
index b62705ffd90d94c841d8f26eabee15dc87022597..f2ecff488a298b05700d45d336255f3f50310893 100644 (file)
@@ -470,8 +470,7 @@ http_server_response_payload_input(struct http_server_response *resp)
 {      
        struct http_server_connection *conn = resp->request->conn;
 
-       if (conn->io_resp_payload != NULL)
-               io_remove(&conn->io_resp_payload);
+       io_remove(&conn->io_resp_payload);
 
        (void)http_server_connection_output(conn);
 }
@@ -490,8 +489,7 @@ int http_server_response_send_more(struct http_server_response *resp,
        i_assert(resp->payload_input != NULL);
        i_assert(resp->payload_output != NULL);
 
-       if (conn->io_resp_payload != NULL)
-               io_remove(&conn->io_resp_payload);
+       io_remove(&conn->io_resp_payload);
 
        /* chunked ostream needs to write to the parent stream's buffer */
        o_stream_set_max_buffer_size(output, IO_BLOCK_SIZE);
index 4a67606ab85d6efcf6ac57710695702c41beccdc..06abb21f187a970af312600cc02f20e42df9c6f9 100644 (file)
@@ -647,8 +647,7 @@ test_client_request_new(void)
 static void
 test_client_request_destroy(struct test_client_request *tcreq)
 {
-       if (tcreq->io != NULL)
-               io_remove(&tcreq->io);
+       io_remove(&tcreq->io);
        if (tcreq->payload != NULL)
                i_stream_unref(&tcreq->payload);
        if (tcreq->file != NULL)
index 450e365175ff192a7b0cf1c043cc7eef33361fcf..1fb4d6f3ffc44a9dc37262b916b146ef8fb81dd4 100644 (file)
@@ -222,8 +222,7 @@ static void
 test_server_hanging_request_payload_destroyed(struct _hanging_request_payload *ctx)
 {
        test_assert(!ctx->serviced);
-       if (ctx->io != NULL)
-               io_remove(&ctx->io);
+       io_remove(&ctx->io);
        i_free(ctx);
        io_loop_stop(ioloop);
 }
@@ -358,8 +357,7 @@ static void
 test_server_hanging_response_payload_destroyed(struct _hanging_response_payload *ctx)
 {
        test_assert(!ctx->serviced);
-       if (ctx->io != NULL)
-               io_remove(&ctx->io);
+       io_remove(&ctx->io);
        i_free(ctx);
        io_loop_stop(ioloop);
 }
index 1018464a8299a9eaf97ec9f6086733b5bba0d941..ba503527c694aa50aaed8a348053059d69506b57 100644 (file)
@@ -448,8 +448,7 @@ void imapc_connection_disconnect_full(struct imapc_connection *conn,
                timeout_remove(&conn->to_throttle_shrink);
        if (conn->parser != NULL)
                imap_parser_unref(&conn->parser);
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        if (conn->ssl_iostream != NULL)
                ssl_iostream_unref(&conn->ssl_iostream);
        if (conn->fd != -1) {
@@ -1668,8 +1667,7 @@ static void imapc_connection_connected(struct imapc_connection *conn)
        struct ip_addr local_ip;
        in_port_t local_port;
        int err;
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
 
        err = net_geterror(conn->fd);
        if (err != 0) {
index 55c5c8c7bf59f7dff484b84cd5091594ee11b65f..de476ab7155e27e7bada8816344cbbe178fde59b 100644 (file)
@@ -71,8 +71,7 @@ master_auth_connection_deinit(struct master_auth_connection **_conn)
 
        if (conn->to != NULL)
                timeout_remove(&conn->to);
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        if (conn->fd != -1) {
                if (close(conn->fd) < 0)
                        i_fatal("close(%s) failed: %m", conn->path);
index b6a6d2300a42d0ce1bc08366fe02df3a0c63fda4..5f6dfd57b823a8701bb30c9bfd35ed79c7d452f0 100644 (file)
@@ -107,8 +107,7 @@ void master_login_auth_disconnect(struct master_login_auth *auth)
 
        if (auth->to != NULL)
                timeout_remove(&auth->to);
-       if (auth->io != NULL)
-               io_remove(&auth->io);
+       io_remove(&auth->io);
        if (auth->fd != -1) {
                if (auth->input != NULL)
                        i_stream_destroy(&auth->input);
index e173fa39c208293e73c56420fbd4fb2c52b32154..60e8bfcbd9a1afd20751bc34823a3f20151943f7 100644 (file)
@@ -470,8 +470,7 @@ static void master_login_conn_close(struct master_login_connection *conn)
 
        DLLIST_REMOVE(&conn->login->conns, conn);
 
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        o_stream_close(conn->output);
        if (close(conn->fd) < 0)
                i_error("close(master login) failed: %m");
index aecab4a93ca40368d8c29d7b26725613ba1ed0a7..4438b5925d05bef04c01c88ea8c6d6972b8ade42 100644 (file)
@@ -76,8 +76,7 @@ master_service_haproxy_conn_free(struct master_service_haproxy_conn *hpconn)
 
        DLLIST_REMOVE(&service->haproxy_conns, hpconn);
 
-       if (hpconn->io != NULL)
-               io_remove(&hpconn->io);
+       io_remove(&hpconn->io);
        if (hpconn->to != NULL)
                timeout_remove(&hpconn->to);
        i_free(hpconn);
index ccea53157664af4d5361c333780cdd5b0447406f..6e66917abd305378f18e5e486aea3992a3e9620d 100644 (file)
@@ -959,10 +959,8 @@ void master_service_deinit(struct master_service **_service)
                timeout_remove(&service->to_overflow_state);
        if (service->to_status != NULL)
                timeout_remove(&service->to_status);
-       if (service->io_status_error != NULL)
-               io_remove(&service->io_status_error);
-       if (service->io_status_write != NULL)
-               io_remove(&service->io_status_write);
+       io_remove(&service->io_status_error);
+       io_remove(&service->io_status_write);
        if (array_is_created(&service->config_overrides))
                array_free(&service->config_overrides);
 
@@ -1076,8 +1074,7 @@ void master_service_io_listeners_remove(struct master_service *service)
        unsigned int i;
 
        for (i = 0; i < service->socket_count; i++) {
-               if (service->listeners[i].io != NULL)
-                       io_remove(&service->listeners[i].io);
+               io_remove(&service->listeners[i].io);
        }
 }
 
@@ -1130,10 +1127,7 @@ master_status_send(struct master_service *service, bool important_update)
                    sizeof(service->master_status));
        if (ret == sizeof(service->master_status)) {
                /* success */
-               if (service->io_status_write != NULL) {
-                       /* delayed important update sent successfully */
-                       io_remove(&service->io_status_write);
-               }
+               io_remove(&service->io_status_write);
                service->last_sent_status_time = ioloop_time;
                service->last_sent_status_avail_count =
                        service->master_status.available_count;
index 987255f174b972607dcddd5dc0b71b8da5ff7630..09517e8c90c1b8305fabf26e5fba12572a53b25e 100644 (file)
@@ -111,8 +111,7 @@ void program_client_disconnect_extra_fds(struct program_client *pclient)
        for(i = 0; i < count; i++) {
                if (efds[i].input != NULL)
                        i_stream_unref(&efds[i].input);
-               if (efds[i].io != NULL)
-                       io_remove(&efds[i].io);
+               io_remove(&efds[i].io);
                if (efds[i].parent_fd != -1 && close(efds[i].parent_fd) < 0)
                        i_error("close(fd=%d) failed: %m", efds[i].parent_fd);
        }
@@ -130,8 +129,7 @@ void program_client_disconnected(struct program_client *pclient)
        if (pclient->program_output != NULL)
                o_stream_destroy(&pclient->program_output);
 
-       if (pclient->io != NULL)
-               io_remove(&pclient->io);
+       io_remove(&pclient->io);
 
        if (pclient->fd_in != -1 && close(pclient->fd_in) < 0)
                i_error("close(%s) failed: %m", pclient->path);
@@ -164,8 +162,7 @@ void program_client_disconnect(struct program_client *pclient, bool force)
 
        if (pclient->to != NULL)
                timeout_remove(&pclient->to);
-       if (pclient->io != NULL)
-               io_remove(&pclient->io);
+       io_remove(&pclient->io);
 
        if ((ret = program_client_close_output(pclient)) < 0)
                pclient->other_error = TRUE;
@@ -588,8 +585,7 @@ void program_client_destroy(struct program_client **_pclient)
        if (pclient->seekable_output != NULL)
                i_stream_unref(&pclient->seekable_output);
 
-       if (pclient->io != NULL)
-               io_remove(&pclient->io);
+       io_remove(&pclient->io);
        i_free(pclient->temp_prefix);
 
        if (pclient->destroy != NULL)
index 6471e67312001aac7a7b9f5628f296e1e98cf132..d2048603a679b7189adf222bb8c74b8b598972f9 100644 (file)
@@ -85,8 +85,7 @@ void test_program_client_destroy(struct test_client **_client)
        if (o_stream_nfinish(client->out) != 0)
                i_error("output error: %s", o_stream_get_error(client->out));
 
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        o_stream_unref(&client->out);
        i_stream_unref(&client->in);
        if (client->os_body != NULL)
index 984bbdf860d7d84acc35da4d9893eedc33969c79..2a9fd1fa8a2049e3b8ca67a0176cc00bcf29c7a4 100644 (file)
@@ -68,8 +68,7 @@ void test_program_client_destroy(struct test_client **_client)
        if (o_stream_nfinish(client->out) != 0)
                i_error("output error: %s", o_stream_get_error(client->out));
 
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        o_stream_unref(&client->out);
        i_stream_unref(&client->in);
        if (client->os_body != NULL)
index 9c2beb34f392aa86bf8b74709c80b08dcebe1a1a..c8bdc5190f8fdeb9410246e051dde20d7d1520c1 100644 (file)
@@ -120,8 +120,7 @@ void lmtp_client_close(struct lmtp_client *client)
                dns_lookup_abort(&client->dns_lookup);
        if (client->to != NULL)
                timeout_remove(&client->to);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        if (client->input != NULL)
                i_stream_close(client->input);
        if (client->output != NULL)
index ec79fdd69ca50dbd99002a902916ef4579967ac1..9c55750d8b6bf56a2c227a8f4ec673841b178f5f 100644 (file)
@@ -276,8 +276,7 @@ static void driver_cassandra_close(struct cassandra_db *db, const char *error)
        struct cassandra_sql_prepared_statement *const *prep_stmtp;
        struct cassandra_result *const *resultp;
 
-       if (db->io_pipe != NULL)
-               io_remove(&db->io_pipe);
+       io_remove(&db->io_pipe);
        if (db->fd_pipe[0] != -1) {
                i_close_fd(&db->fd_pipe[0]);
                i_close_fd(&db->fd_pipe[1]);
index bce45ce6760df771f41df30bf4a096918102f00b..c0f4e4357677aa68e36dfe6f00390276a5552d07 100644 (file)
@@ -201,8 +201,7 @@ static void pop3c_client_disconnect(struct pop3c_client *client)
                dns_lookup_abort(&client->dns_lookup);
        if (client->to != NULL)
                timeout_remove(&client->to);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        if (client->input != NULL)
                i_stream_destroy(&client->input);
        if (client->output != NULL)
index d121ff50ad613e514dc98305f7d15554fdbd2b04..21c0471e2e6419441b0b8f715dcce1152e200581 100644 (file)
@@ -179,10 +179,8 @@ void mailbox_list_index_notify_deinit(struct mailbox_list_notify *notify)
                mailbox_free(&inotify->inbox);
        if (inotify->subscriptions != NULL)
                mailbox_tree_deinit(&inotify->subscriptions);
-       if (inotify->io_wait != NULL)
-               io_remove(&inotify->io_wait);
-       if (inotify->io_wait_inbox != NULL)
-               io_remove(&inotify->io_wait_inbox);
+       io_remove(&inotify->io_wait);
+       io_remove(&inotify->io_wait_inbox);
        if (inotify->to_wait != NULL)
                timeout_remove(&inotify->to_wait);
        if (inotify->to_notify != NULL)
@@ -927,10 +925,8 @@ void mailbox_list_index_notify_wait(struct mailbox_list_notify *notify,
        inotify->wait_context = context;
 
        if (callback == NULL) {
-               if (inotify->io_wait != NULL)
-                       io_remove(&inotify->io_wait);
-               if (inotify->io_wait_inbox != NULL)
-                       io_remove(&inotify->io_wait_inbox);
+               io_remove(&inotify->io_wait);
+               io_remove(&inotify->io_wait_inbox);
                if (inotify->to_wait != NULL)
                        timeout_remove(&inotify->to_wait);
                if (inotify->to_notify != NULL)
index 35f4e4151fb32a7696a683d9bce41f80afc84616..67c74e287a7a2de4f62dbc659d36c399259059a8 100644 (file)
@@ -93,8 +93,7 @@ void mailbox_watch_remove_all(struct mailbox *box)
                file = box->notify_files;
                box->notify_files = file->next;
 
-               if (file->io_notify != NULL)
-                       io_remove(&file->io_notify);
+               io_remove(&file->io_notify);
                 i_free(file->path);
                i_free(file);
        }
index 2ea849b6e9be1c521e075939f5776e835c97ed6e..bce059cc7f9dca93cdf65df82eb3f2203cf1d442 100644 (file)
@@ -313,8 +313,7 @@ void connection_disconnect(struct connection *conn)
        i_zero(&conn->last_input_tv);
        if (conn->to != NULL)
                timeout_remove(&conn->to);
-       if (conn->io != NULL)
-               io_remove(&conn->io);
+       io_remove(&conn->io);
        if (conn->input != NULL) {
                i_stream_close(conn->input);
                i_stream_destroy(&conn->input);
index c8478872c9f4b5b3c1b3bda3de3f748e4d995525..7cc93fbed4968d35efc2b3b650beef61568bfe02 100644 (file)
@@ -234,8 +234,7 @@ int io_loop_extract_notify_fd(struct ioloop *ioloop)
        }
        for (io = ctx->fd_ctx.notifies; io != NULL; io = io->next)
                io->fd = -1;
-       if (ctx->event_io != NULL)
-               io_remove(&ctx->event_io);
+       io_remove(&ctx->event_io);
        fd = ctx->inotify_fd;
        ctx->inotify_fd = new_inotify_fd;
        return fd;
index e7d8da52103d531b231bce5eaa623bfd1129b7e1..57c039cd29bb03b6c41361177a06f00e8ec9d940 100644 (file)
@@ -118,8 +118,7 @@ void io_loop_notify_handler_deinit(struct ioloop *ioloop)
                io_remove(&_io);
        }
 
-       if (ctx->event_io)
-               io_remove(&ctx->event_io);
+       io_remove(&ctx->event_io);
        if (close(ctx->kq) < 0)
                i_error("close(kqueue notify) failed: %m");
        i_free(ctx);
@@ -217,8 +216,7 @@ int io_loop_extract_notify_fd(struct ioloop *ioloop)
        }
        for (io = ctx->notifies; io != NULL; io = io->next)
                io->fd = -1;
-       if (ctx->event_io != NULL)
-               io_remove(&ctx->event_io);
+       io_remove(&ctx->event_io);
        fd = ctx->kq;
        ctx->kq = new_kq;
        return fd;
index f5e6e0fb7ffb7f87a2dbd72a93bf22dd7a351c49..1d3901187dd6c6b5e31bcbe1ac5685caa1a2c36e 100644 (file)
@@ -168,8 +168,7 @@ void iostream_pump_stop(struct iostream_pump *pump)
 
        o_stream_unset_flush_callback(pump->output);
 
-       if (pump->io != NULL)
-               io_remove(&pump->io);
+       io_remove(&pump->io);
 }
 
 void iostream_pump_switch_ioloop(struct iostream_pump *pump)
index 0c5d1c116cada1bacd63668f6eada49798f7eddd..8b0fe8d364a0bed5ba706cf72452f9a62a6b04e7 100644 (file)
@@ -34,8 +34,7 @@ static struct ostream * o_stream_create_fd_common(int fd,
 
 static void stream_closed(struct file_ostream *fstream)
 {
-       if (fstream->io != NULL)
-               io_remove(&fstream->io);
+       io_remove(&fstream->io);
 
        if (fstream->autoclose_fd && fstream->fd != -1) {
                if (close(fstream->fd) < 0) {
@@ -485,10 +484,7 @@ static void stream_send_io(struct file_ostream *fstream)
                fstream->flush_pending = TRUE;
 
        if (!fstream->flush_pending && IS_STREAM_EMPTY(fstream)) {
-               if (fstream->io != NULL) {
-                       /* all sent */
-                       io_remove(&fstream->io);
-               }
+               io_remove(&fstream->io);
        } else if (!fstream->ostream.ostream.closed) {
                /* Add the IO handler if it's not there already. Callback
                   might have just returned 0 without there being any data
index ad29a3971f027ae7679b8d401d654837b006a32c..23cfc00e3c9460ecfcb1bd55fc6b63bde5ca75ff 100644 (file)
@@ -226,8 +226,7 @@ const char *client_remote_id(struct client *client)
 
 void client_io_reset(struct client *client)
 {
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        if (client->to_idle != NULL)
                timeout_remove(&client->to_idle);
        client->io = io_add(client->fd_in, IO_READ, client_input, client);
@@ -295,8 +294,7 @@ void client_destroy(struct client *client, const char *prefix,
                mail_user_unref(&client->raw_mail_user);
        if (client->proxy != NULL)
                lmtp_proxy_deinit(&client->proxy);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        if (client->to_idle != NULL)
                timeout_remove(&client->to_idle);
        if (client->ssl_iostream != NULL)
index e687705e5a1da95cdfe7a25e90800dcdf2762ce8..aa8d8450cd3d5a5cadd5a266c8f79001457a348e 100644 (file)
@@ -437,8 +437,7 @@ log_connection_destroy(struct log_connection *log, bool shutting_down)
        }
 
        i_stream_unref(&log->input);
-       if (log->io != NULL)
-               io_remove(&log->io);
+       io_remove(&log->io);
        if (close(log->fd) < 0)
                i_error("close(log connection fd) failed: %m");
        i_free(log->default_prefix);
index d5e9bc52e39c4917e256125fdff68ad7e8fd5982..92709b46a73b11719e78c9adf8aaeba481a47a3d 100644 (file)
@@ -69,8 +69,7 @@ static void client_auth_failed(struct client *client)
        if (client->auth_initializing || client->destroyed)
                return;
 
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
 
        client->io = io_add(client->fd, IO_READ, client_input, client);
        client_input(client);
@@ -463,8 +462,7 @@ static int proxy_start(struct client *client,
        client->proxy_not_trusted = reply->proxy_not_trusted;
 
        /* disable input until authentication is finished */
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        return 0;
 }
 
@@ -781,8 +779,7 @@ int client_auth_begin(struct client *client, const char *mech_name,
                return 1;
 
        /* don't handle input until we get the initial auth reply */
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        client_set_auth_waiting(client);
        return 0;
 }
index 2f5f696c2e267ae7eee58ebc9464817728309f15..c9f394d0c305ea42e8176b83c8ba5b2c316f2c8e 100644 (file)
@@ -263,8 +263,7 @@ void client_destroy(struct client *client, const char *reason)
                i_assert(!client->authenticating);
        }
 
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        if (client->to_disconnect != NULL)
                timeout_remove(&client->to_disconnect);
        if (client->to_auth_waiting != NULL)
@@ -473,8 +472,7 @@ void client_cmd_starttls(struct client *client)
 
        /* remove input handler, SSL proxy gives us a new fd. we also have to
           remove it in case we have to wait for buffer to be flushed */
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
 
        client->v.notify_starttls(client, TRUE, "Begin TLS negotiation now.");
 
index 961274347bfd33807fa549086a8d612ff1fc6d10..49f80a8204dee42b44fdbdf21d8ce3f963eb520e 100644 (file)
@@ -479,8 +479,7 @@ static void login_proxy_disconnect(struct login_proxy *proxy)
                proxy->state_rec->num_proxying_connections--;
        }
 
-       if (proxy->server_io != NULL)
-               io_remove(&proxy->server_io);
+       io_remove(&proxy->server_io);
        if (proxy->server_input != NULL)
                i_stream_destroy(&proxy->server_input);
        if (proxy->server_output != NULL)
@@ -502,8 +501,7 @@ static void login_proxy_free_final(struct login_proxy *proxy)
                timeout_remove(&proxy->to);
        }
 
-       if (proxy->client_io != NULL)
-               io_remove(&proxy->client_io);
+       io_remove(&proxy->client_io);
        if (proxy->client_input != NULL)
                i_stream_destroy(&proxy->client_input);
        if (proxy->client_output != NULL)
index 8d546f8963013db676bbc76881d990ee806e9ddc..573f4934dd74982a7f3e1c0b833133b1c8deedad 100644 (file)
@@ -152,8 +152,7 @@ client_connected_finish(const struct master_service_connection *conn)
 
 static void login_access_lookup_free(struct login_access_lookup *lookup)
 {
-       if (lookup->io != NULL)
-               io_remove(&lookup->io);
+       io_remove(&lookup->io);
        if (lookup->access != NULL)
                access_lookup_destroy(&lookup->access);
        if (lookup->conn.fd != -1) {
@@ -185,8 +184,7 @@ static void login_access_lookup_next(struct login_access_lookup *lookup)
 {
        if (*lookup->next_socket == NULL) {
                /* last one */
-               if (lookup->io != NULL)
-                       io_remove(&lookup->io);
+               io_remove(&lookup->io);
                client_connected_finish(&lookup->conn);
                lookup->conn.fd = -1;
                login_access_lookup_free(lookup);
index af14e80454fbd399c17a0685f9ce266bcf7a94a5..017cd8630f0101c1a9d8576ac5c11e1e0f618f02 100644 (file)
@@ -203,8 +203,7 @@ static void ssl_set_io(struct ssl_proxy *proxy, enum ssl_io_action action)
                                            ssl_step, proxy);
                break;
        case SSL_REMOVE_INPUT:
-               if (proxy->io_ssl_read != NULL)
-                       io_remove(&proxy->io_ssl_read);
+               io_remove(&proxy->io_ssl_read);
                break;
        case SSL_ADD_OUTPUT:
                if (proxy->io_ssl_write != NULL)
@@ -213,8 +212,7 @@ static void ssl_set_io(struct ssl_proxy *proxy, enum ssl_io_action action)
                                             ssl_step, proxy);
                break;
        case SSL_REMOVE_OUTPUT:
-               if (proxy->io_ssl_write != NULL)
-                       io_remove(&proxy->io_ssl_write);
+               io_remove(&proxy->io_ssl_write);
                break;
        }
 }
@@ -222,8 +220,7 @@ static void ssl_set_io(struct ssl_proxy *proxy, enum ssl_io_action action)
 static void plain_block_input(struct ssl_proxy *proxy, bool block)
 {
        if (block) {
-               if (proxy->io_plain_read != NULL)
-                       io_remove(&proxy->io_plain_read);
+               io_remove(&proxy->io_plain_read);
        } else {
                if (proxy->io_plain_read == NULL) {
                        proxy->io_plain_read = io_add(proxy->fd_plain, IO_READ,
@@ -293,8 +290,7 @@ static void plain_write(struct ssl_proxy *proxy)
                                               plain_write, proxy);
                        }
                } else {
-                       if (proxy->io_plain_write != NULL)
-                               io_remove(&proxy->io_plain_write);
+                       io_remove(&proxy->io_plain_write);
                }
 
                ssl_set_io(proxy, SSL_ADD_INPUT);
@@ -731,14 +727,10 @@ void ssl_proxy_destroy(struct ssl_proxy *proxy)
        ssl_proxy_count--;
        DLLIST_REMOVE(&ssl_proxies, proxy);
 
-       if (proxy->io_ssl_read != NULL)
-               io_remove(&proxy->io_ssl_read);
-       if (proxy->io_ssl_write != NULL)
-               io_remove(&proxy->io_ssl_write);
-       if (proxy->io_plain_read != NULL)
-               io_remove(&proxy->io_plain_read);
-       if (proxy->io_plain_write != NULL)
-               io_remove(&proxy->io_plain_write);
+       io_remove(&proxy->io_ssl_read);
+       io_remove(&proxy->io_ssl_write);
+       io_remove(&proxy->io_plain_read);
+       io_remove(&proxy->io_plain_write);
 
        if (SSL_shutdown(proxy->ssl) != 1) {
                /* if bidirectional shutdown fails we need to clear
index 058e8f3d14470ec523b772639e0bc0683096fe83..67be42c466a6f4d62f4aa7f40f1fcce4d65fbb76 100644 (file)
@@ -403,8 +403,7 @@ void service_monitor_listen_stop(struct service *service)
        array_foreach(&service->listeners, listeners) {
                struct service_listener *l = *listeners;
 
-               if (l->io != NULL)
-                       io_remove(&l->io);
+               io_remove(&l->io);
        }
        service->listening = FALSE;
        service->listen_pending = FALSE;
@@ -526,8 +525,7 @@ void service_monitor_stop(struct service *service)
 {
        int i;
 
-       if (service->io_status != NULL)
-               io_remove(&service->io_status);
+       io_remove(&service->io_status);
 
        if (service->status_fd[0] != -1 &&
            service->type != SERVICE_TYPE_ANVIL) {
@@ -656,8 +654,7 @@ void services_monitor_stop(struct service_list *service_list, bool wait)
        if (wait)
                services_monitor_wait_and_kill(service_list);
 
-       if (service_list->io_master != NULL)
-               io_remove(&service_list->io_master);
+       io_remove(&service_list->io_master);
        i_close_fd(&service_list->master_fd);
 
        array_foreach(&service_list->services, services)
index 90b8ccf05b45a91605548f373aaa87103a90fb85..e12ae0a581c962023b2a8b67c5c9d6240d4a92b2 100644 (file)
@@ -78,8 +78,7 @@ void service_process_notify_deinit(struct service_process_notify **_notify)
        *_notify = NULL;
 
        service_process_notify_reset(notify);
-       if (notify->io_write != NULL)
-               io_remove(&notify->io_write);
+       io_remove(&notify->io_write);
        aqueue_deinit(&notify->process_queue);
        array_free(&notify->processes);
        i_free(notify);
index 1a17b0e4897838e83cae9f0d6fa81c5a476237b9..cc9d4ba569b5c29c102261fc73d7b4d853f3eab4 100644 (file)
@@ -247,8 +247,7 @@ static int fts_parser_tika_deinit(struct fts_parser *_parser)
           timeout to ioloop unnecessarily */
        if (parser->payload != NULL)
                i_stream_unref(&parser->payload);
-       if (parser->io != NULL)
-               io_remove(&parser->io);
+       io_remove(&parser->io);
        if (parser->http_req != NULL)
                http_client_request_abort(&parser->http_req);
        if (parser->ioloop != NULL) {
index 96d7c6cfbf3ca16770887321c80e38fd204e0e8a..548acfd25672a7c2c41037d18a923264e3f08a0d 100644 (file)
@@ -613,8 +613,7 @@ static void client_default_destroy(struct client *client, const char *reason)
        i_free(client->seen_bitmask);
        i_free(client->msgnum_to_seq_map);
 
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        timeout_remove(&client->to_idle);
        if (client->to_commit != NULL)
                timeout_remove(&client->to_commit);
index 7d3a8d07ee58002e618cb3b3a8f2f9e6583a49af..876c53062a96ed28c7d1b0b6879cf7c1aa95fe08 100644 (file)
@@ -171,8 +171,7 @@ void client_destroy(struct client **_client)
        *_client = NULL;
 
        DLLIST_REMOVE(&clients, client);
-       if (client->io != NULL)
-               io_remove(&client->io);
+       io_remove(&client->io);
        i_stream_destroy(&client->input);
        o_stream_destroy(&client->output);
        if (close(client->fd) < 0)
index 7cc276cd1f5dc8982b23b034c97909bb7c2cce8c..dad728fbfca55f1c2c4429c453e18618ca8939a1 100644 (file)
@@ -33,8 +33,7 @@ stats_carbon_destroy(struct stats_send_ctx **_ctx)
        struct stats_send_ctx *ctx = *_ctx;
        *_ctx = NULL;
 
-       if (ctx->io != NULL)
-               io_remove(&ctx->io);
+       io_remove(&ctx->io);
        if (ctx->to != NULL)
                timeout_remove(&ctx->to);
        i_close_fd(&ctx->fd);
index da0223e1a2dbcd35c9dbc377bda02a1fd83f7a18..6c0c36da4042c6b8d1f6d035e758cac3ca0d50f7 100644 (file)
@@ -61,10 +61,8 @@ static void rawlog_proxy_destroy(struct rawlog_proxy *proxy)
                }
                o_stream_destroy(&proxy->out_output);
        }
-       if (proxy->client_io != NULL)
-               io_remove(&proxy->client_io);
-       if (proxy->server_io != NULL)
-               io_remove(&proxy->server_io);
+       io_remove(&proxy->client_io);
+       io_remove(&proxy->server_io);
        if (proxy->to_flush != NULL)
                timeout_remove(&proxy->to_flush);