From: Josef 'Jeff' Sipek Date: Tue, 6 Jun 2017 09:33:23 +0000 (+0300) Subject: global: start relying on timeout_remove(NULL) being a no-op X-Git-Tag: 2.3.0.rc1~984 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d1b8b6bec79746c5d89d57dd8c1688946bd9237;p=thirdparty%2Fdovecot%2Fcore.git global: start relying on timeout_remove(NULL) being a no-op Cleanup performed with the following semantic patch: @@ expression E; @@ - if (E != NULL) { - timeout_remove(&E); - } + timeout_remove(&E); --- diff --git a/src/anvil/penalty.c b/src/anvil/penalty.c index ce6a15587c..73c1c7d31b 100644 --- a/src/anvil/penalty.c +++ b/src/anvil/penalty.c @@ -78,8 +78,7 @@ void penalty_deinit(struct penalty **_penalty) penalty_rec_free(penalty, penalty->oldest); hash_table_destroy(&penalty->hash); - if (penalty->to != NULL) - timeout_remove(&penalty->to); + timeout_remove(&penalty->to); i_free(penalty); } diff --git a/src/auth/auth-request-handler.c b/src/auth/auth-request-handler.c index 543c4bf28e..87c5bdefbd 100644 --- a/src/auth/auth-request-handler.c +++ b/src/auth/auth-request-handler.c @@ -832,8 +832,7 @@ void auth_request_handler_flush_failures(bool flush_all) count = aqueue_count(auth_failures); if (count == 0) { - if (to_auth_failures != NULL) - timeout_remove(&to_auth_failures); + timeout_remove(&to_auth_failures); return; } @@ -894,6 +893,5 @@ void auth_request_handler_deinit(void) array_free(&auth_failures_arr); aqueue_deinit(&auth_failures); - if (to_auth_failures != NULL) - timeout_remove(&to_auth_failures); + timeout_remove(&to_auth_failures); } diff --git a/src/auth/auth-request.c b/src/auth/auth-request.c index 33e6a50274..6dc2705a23 100644 --- a/src/auth/auth-request.c +++ b/src/auth/auth-request.c @@ -175,8 +175,7 @@ void auth_request_success_continue(struct auth_policy_check_ctx *ctx) struct auth_stats *stats; i_assert(request->state == AUTH_REQUEST_STATE_MECH_CONTINUE); - if (request->to_penalty != NULL) - timeout_remove(&request->to_penalty); + timeout_remove(&request->to_penalty); if (request->failed || !request->passdb_success) { /* password was valid, but some other check failed. */ @@ -256,10 +255,8 @@ void auth_request_unref(struct auth_request **_request) if (request->dns_lookup_ctx != NULL) dns_lookup_abort(&request->dns_lookup_ctx->dns_lookup); - if (request->to_abort != NULL) - timeout_remove(&request->to_abort); - if (request->to_penalty != NULL) - timeout_remove(&request->to_penalty); + timeout_remove(&request->to_abort); + timeout_remove(&request->to_penalty); if (request->mech != NULL) request->mech->auth_free(request); @@ -985,8 +982,7 @@ void auth_request_policy_penalty_finish(void *context) { struct auth_policy_check_ctx *ctx = context; - if (ctx->request->to_penalty != NULL) - timeout_remove(&ctx->request->to_penalty); + timeout_remove(&ctx->request->to_penalty); i_assert(ctx->request->state == AUTH_REQUEST_STATE_MECH_CONTINUE); diff --git a/src/auth/auth-worker-client.c b/src/auth/auth-worker-client.c index 4fa775b7eb..4d07018a3d 100644 --- a/src/auth/auth-worker-client.c +++ b/src/auth/auth-worker-client.c @@ -603,8 +603,7 @@ auth_worker_handle_list(struct auth_worker_client *client, } io_remove(&ctx->client->io); - if (ctx->client->to_idle != NULL) - timeout_remove(&ctx->client->to_idle); + timeout_remove(&ctx->client->to_idle); o_stream_set_flush_callback(ctx->client->output, auth_worker_list_output, ctx); @@ -787,8 +786,7 @@ void auth_worker_client_destroy(struct auth_worker_client **_client) i_stream_close(client->input); o_stream_close(client->output); - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); io_remove(&client->io); net_disconnect(client->fd); diff --git a/src/auth/auth-worker-server.c b/src/auth/auth-worker-server.c index be905cf4bb..753da46d85 100644 --- a/src/auth/auth-worker-server.c +++ b/src/auth/auth-worker-server.c @@ -243,8 +243,7 @@ static void auth_worker_destroy(struct auth_worker_connection **_conn, io_remove(&conn->io); i_stream_destroy(&conn->input); o_stream_destroy(&conn->output); - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); if (close(conn->fd) < 0) i_error("close(auth worker) failed: %m"); @@ -479,8 +478,7 @@ void auth_worker_server_resume_input(struct auth_worker_connection *conn) conn->io = io_add(conn->fd, IO_READ, worker_input, conn); if (!conn->timeout_pending_resume) { conn->timeout_pending_resume = TRUE; - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); conn->to = timeout_add_short(0, worker_input_resume, conn); } } diff --git a/src/auth/db-ldap.c b/src/auth/db-ldap.c index 5bf9fa4b56..6a705408c8 100644 --- a/src/auth/db-ldap.c +++ b/src/auth/db-ldap.c @@ -480,8 +480,7 @@ static int db_ldap_connect_finish(struct ldap_connection *conn, int ret) return -1; } - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); conn->conn_state = LDAP_CONN_STATE_BOUND_DEFAULT; while (db_ldap_request_queue_next(conn)) ; @@ -1061,8 +1060,7 @@ static int db_ldap_bind_simple(struct ldap_connection *conn) conn->conn_state = LDAP_CONN_STATE_BINDING; conn->default_bind_msgid = msgid; - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); conn->to = timeout_add(DB_LDAP_REQUEST_LOST_TIMEOUT_SECS*1000, ldap_connection_timeout, conn); return 0; @@ -1317,8 +1315,7 @@ static void db_ldap_conn_close(struct ldap_connection *conn) conn->delayed_connect = FALSE; conn->default_bind_msgid = -1; - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); if (conn->pending_count != 0) { requests = array_idx(&conn->request_array, 0); diff --git a/src/dict/dict-connection.c b/src/dict/dict-connection.c index e171adab1e..934ea2d54d 100644 --- a/src/dict/dict-connection.c +++ b/src/dict/dict-connection.c @@ -258,8 +258,7 @@ bool dict_connection_unref(struct dict_connection *conn) static void dict_connection_unref_safe_callback(struct dict_connection *conn) { - if (conn->to_unref != NULL) - timeout_remove(&conn->to_unref); + timeout_remove(&conn->to_unref); (void)dict_connection_unref(conn); } @@ -289,8 +288,7 @@ void dict_connection_destroy(struct dict_connection *conn) conn->destroyed = TRUE; DLLIST_REMOVE(&dict_connections, conn); - if (conn->to_input != NULL) - timeout_remove(&conn->to_input); + timeout_remove(&conn->to_input); io_remove(&conn->io); i_stream_close(conn->input); o_stream_close(conn->output); diff --git a/src/dict/main.c b/src/dict/main.c index 536737e8cc..9df0a97c1d 100644 --- a/src/dict/main.c +++ b/src/dict/main.c @@ -117,8 +117,7 @@ static void main_init(void) static void main_deinit(void) { - if (to_proctitle != NULL) - timeout_remove(&to_proctitle); + timeout_remove(&to_proctitle); dict_connections_destroy_all(); dict_drivers_unregister_all(); diff --git a/src/director/director-connection.c b/src/director/director-connection.c index 40f1eb5dd6..9804ad4508 100644 --- a/src/director/director-connection.c +++ b/src/director/director-connection.c @@ -2186,10 +2186,8 @@ void director_connection_deinit(struct director_connection **_conn, director_host_unref(conn->connect_request_to); if (conn->user_iter != NULL) director_iterate_users_deinit(&conn->user_iter); - if (conn->to_disconnect != NULL) - timeout_remove(&conn->to_disconnect); - if (conn->to_pong != NULL) - timeout_remove(&conn->to_pong); + timeout_remove(&conn->to_disconnect); + timeout_remove(&conn->to_pong); timeout_remove(&conn->to_ping); io_remove(&conn->io); i_stream_unref(&conn->input); diff --git a/src/director/director-test.c b/src/director/director-test.c index fb9428bc84..4f60a6b8fb 100644 --- a/src/director/director-test.c +++ b/src/director/director-test.c @@ -152,15 +152,13 @@ static void client_username_check(struct imap_client *client) user->last_seen = ioloop_time; user->host->refcount++; - if (user->to != NULL) - timeout_remove(&user->to); + timeout_remove(&user->to); } static void user_free(struct user *user) { host_unref(&user->host); - if (user->to != NULL) - timeout_remove(&user->to); + timeout_remove(&user->to); hash_table_remove(users, user->username); i_free(user->username); i_free(user); @@ -367,8 +365,7 @@ static void director_connection_destroy(struct director_connection **_conn) DLLIST_REMOVE(&director_connections, conn); - if (conn->to_delay != NULL) - timeout_remove(&conn->to_delay); + timeout_remove(&conn->to_delay); io_remove(&conn->in_io); i_stream_unref(&conn->in_input); @@ -477,8 +474,7 @@ static void admin_disconnect(struct admin_connection **_conn) struct admin_connection *conn = *_conn; *_conn = NULL; - if (conn->to_random != NULL) - timeout_remove(&conn->to_random); + timeout_remove(&conn->to_random); i_stream_destroy(&conn->input); io_remove(&conn->io); net_disconnect(conn->fd); diff --git a/src/director/director.c b/src/director/director.c index ebd86d0e7d..b7049c796e 100644 --- a/src/director/director.c +++ b/src/director/director.c @@ -213,8 +213,7 @@ static bool director_wait_for_others(struct director *dir) (*hostp)->last_network_failure = 0; (*hostp)->last_protocol_failure = 0; } - if (dir->to_reconnect != NULL) - timeout_remove(&dir->to_reconnect); + timeout_remove(&dir->to_reconnect); dir->to_reconnect = timeout_add(DIRECTOR_QUICK_RECONNECT_TIMEOUT_MSECS, director_quick_reconnect_retry, dir); return TRUE; @@ -281,8 +280,7 @@ void director_set_ring_handshaked(struct director *dir) { i_assert(!dir->ring_handshaked); - if (dir->to_handshake_warning != NULL) - timeout_remove(&dir->to_handshake_warning); + timeout_remove(&dir->to_handshake_warning); if (dir->ring_handshake_warning_sent) { i_warning("Directors have been connected, " "continuing delayed requests"); @@ -321,8 +319,7 @@ void director_set_ring_synced(struct director *dir) i_assert((dir->left != NULL && dir->right != NULL) || (dir->left == NULL && dir->right == NULL)); - if (dir->to_handshake_warning != NULL) - timeout_remove(&dir->to_handshake_warning); + timeout_remove(&dir->to_handshake_warning); if (dir->ring_handshake_warning_sent) { i_warning("Ring is synced, continuing delayed requests " "(syncing took %d secs, hosts_hash=%u)", @@ -334,8 +331,7 @@ void director_set_ring_synced(struct director *dir) host = dir->right == NULL ? NULL : director_connection_get_host(dir->right); - if (dir->to_reconnect != NULL) - timeout_remove(&dir->to_reconnect); + timeout_remove(&dir->to_reconnect); if (host != director_get_preferred_right_host(dir)) { /* try to reconnect to preferred host later */ dir->to_reconnect = @@ -347,8 +343,7 @@ void director_set_ring_synced(struct director *dir) director_connection_set_synced(dir->left, TRUE); if (dir->right != NULL) director_connection_set_synced(dir->right, TRUE); - if (dir->to_sync != NULL) - timeout_remove(&dir->to_sync); + timeout_remove(&dir->to_sync); dir->ring_synced = TRUE; dir->ring_last_sync_time = ioloop_time; mail_hosts_set_synced(dir->mail_hosts); @@ -872,8 +867,7 @@ static void director_user_move_free(struct user *user) dir_debug("User %u move finished at state=%s", user->username_hash, user_kill_state_names[kill_ctx->kill_state]); - if (kill_ctx->to_move != NULL) - timeout_remove(&kill_ctx->to_move); + timeout_remove(&kill_ctx->to_move); i_free(kill_ctx->socket_path); i_free(kill_ctx); user->kill_ctx = NULL; @@ -1354,8 +1348,7 @@ static void director_user_freed(struct user *user) if (user->kill_ctx->callback_pending) { /* kill_ctx is used as a callback parameter. only remove the timeout and finish the free later. */ - if (user->kill_ctx->to_move != NULL) - timeout_remove(&user->kill_ctx->to_move); + timeout_remove(&user->kill_ctx->to_move); } else { director_user_move_free(user); } @@ -1403,18 +1396,12 @@ void director_deinit(struct director **_dir) mail_hosts_deinit(&dir->orig_config_hosts); ipc_client_deinit(&dir->ipc_proxy); - if (dir->to_reconnect != NULL) - timeout_remove(&dir->to_reconnect); - if (dir->to_handshake_warning != NULL) - timeout_remove(&dir->to_handshake_warning); - if (dir->to_request != NULL) - timeout_remove(&dir->to_request); - if (dir->to_sync != NULL) - timeout_remove(&dir->to_sync); - if (dir->to_remove_dirs != NULL) - timeout_remove(&dir->to_remove_dirs); - if (dir->to_callback != NULL) - timeout_remove(&dir->to_callback); + timeout_remove(&dir->to_reconnect); + timeout_remove(&dir->to_handshake_warning); + timeout_remove(&dir->to_request); + timeout_remove(&dir->to_sync); + timeout_remove(&dir->to_remove_dirs); + timeout_remove(&dir->to_callback); while (array_count(&dir->dir_hosts) > 0) { hostp = array_idx(&dir->dir_hosts, 0); host = *hostp; diff --git a/src/director/main.c b/src/director/main.c index 121cc8fb79..853668bebf 100644 --- a/src/director/main.c +++ b/src/director/main.c @@ -287,8 +287,7 @@ static void main_preinit(void) static void main_deinit(void) { - if (to_proctitle_refresh != NULL) - timeout_remove(&to_proctitle_refresh); + timeout_remove(&to_proctitle_refresh); if (notify_conn != NULL) notify_connection_deinit(¬ify_conn); /* deinit doveadm connections before director, so it can clean up diff --git a/src/doveadm/server-connection.c b/src/doveadm/server-connection.c index e3bbd58f75..0ecf996c98 100644 --- a/src/doveadm/server-connection.c +++ b/src/doveadm/server-connection.c @@ -305,8 +305,7 @@ static void server_connection_input(struct server_connection *conn) { const char *line; - if (conn->to_input != NULL) - timeout_remove(&conn->to_input); + timeout_remove(&conn->to_input); if (!conn->handshaked) { if ((line = i_stream_read_next_line(conn->input)) == NULL) { @@ -551,8 +550,7 @@ void server_connection_destroy(struct server_connection **_conn) if (printing_conn == conn) print_connection_released(); - if (conn->to_input != NULL) - timeout_remove(&conn->to_input); + timeout_remove(&conn->to_input); if (conn->input != NULL) i_stream_destroy(&conn->input); if (conn->output != NULL) diff --git a/src/imap-hibernate/imap-client.c b/src/imap-hibernate/imap-client.c index f61f8666aa..53b28767b5 100644 --- a/src/imap-hibernate/imap-client.c +++ b/src/imap-hibernate/imap-client.c @@ -430,8 +430,7 @@ static void imap_client_add_idle_keepalive_timeout(struct imap_client *client) &client->state.remote_ip, interval); - if (client->to_keepalive!= NULL) - timeout_remove(&client->to_keepalive); + timeout_remove(&client->to_keepalive); client->to_keepalive = timeout_add(interval, keepalive_timeout, client); } @@ -587,8 +586,7 @@ static void imap_client_stop(struct imap_client *client) if (client->unhibernate_queued) priorityq_remove(unhibernate_queue, &client->item); io_remove(&client->io); - if (client->to_keepalive != NULL) - timeout_remove(&client->to_keepalive); + timeout_remove(&client->to_keepalive); array_foreach_modifiable(&client->notifys, notify) { io_remove(¬ify->io); @@ -715,7 +713,6 @@ void imap_clients_deinit(void) imap_client_io_activate_user(client); imap_client_destroy(&client, "Shutting down"); } - if (to_unhibernate != NULL) - timeout_remove(&to_unhibernate); + timeout_remove(&to_unhibernate); priorityq_deinit(&unhibernate_queue); } diff --git a/src/imap-login/imap-login-client.c b/src/imap-login/imap-login-client.c index f6e1d01feb..74f9305ca3 100644 --- a/src/imap-login/imap-login-client.c +++ b/src/imap-login/imap-login-client.c @@ -592,8 +592,7 @@ static void imap_client_input(struct client *client) don't allow any commands */ client_notify_status(client, FALSE, AUTH_SERVER_WAITING_MSG); - if (client->to_auth_waiting != NULL) - timeout_remove(&client->to_auth_waiting); + timeout_remove(&client->to_auth_waiting); client->input_blocked = TRUE; break; diff --git a/src/imap-urlauth/imap-urlauth-client.c b/src/imap-urlauth/imap-urlauth-client.c index 5fbe3cff21..20850de250 100644 --- a/src/imap-urlauth/imap-urlauth-client.c +++ b/src/imap-urlauth/imap-urlauth-client.c @@ -332,8 +332,7 @@ void client_destroy(struct client *client, const char *reason) imap_urlauth_client_count--; DLLIST_REMOVE(&imap_urlauth_clients, client); - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); client_worker_disconnect(client); diff --git a/src/imap-urlauth/imap-urlauth-login.c b/src/imap-urlauth/imap-urlauth-login.c index fe0d455882..7fa2c0a669 100644 --- a/src/imap-urlauth/imap-urlauth-login.c +++ b/src/imap-urlauth/imap-urlauth-login.c @@ -115,8 +115,7 @@ static void imap_urlauth_client_input(struct client *client) if (!auth_client_is_connected(auth_client)) { /* we're not currently connected to auth process - don't allow any commands */ - if (client->to_auth_waiting != NULL) - timeout_remove(&client->to_auth_waiting); + timeout_remove(&client->to_auth_waiting); client->input_blocked = TRUE; } else { imap_urlauth_client_handle_input(client); diff --git a/src/imap-urlauth/imap-urlauth-worker.c b/src/imap-urlauth/imap-urlauth-worker.c index b5f60e1aa0..b24554016b 100644 --- a/src/imap-urlauth/imap-urlauth-worker.c +++ b/src/imap-urlauth/imap-urlauth-worker.c @@ -240,8 +240,7 @@ static void client_destroy(struct client *client) io_remove(&client->io); io_remove(&client->ctrl_io); - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); if (client->input != NULL) i_stream_destroy(&client->input); diff --git a/src/imap/cmd-idle.c b/src/imap/cmd-idle.c index 092bc83b34..d7aba8e09d 100644 --- a/src/imap/cmd-idle.c +++ b/src/imap/cmd-idle.c @@ -28,10 +28,8 @@ idle_finish(struct cmd_idle_context *ctx, bool done_ok, bool free_cmd) { struct client *client = ctx->client; - if (ctx->keepalive_to != NULL) - timeout_remove(&ctx->keepalive_to); - if (ctx->to_hibernate != NULL) - timeout_remove(&ctx->to_hibernate); + timeout_remove(&ctx->keepalive_to); + timeout_remove(&ctx->to_hibernate); if (ctx->sync_ctx != NULL) { /* we're here only in connection failure cases */ @@ -139,11 +137,9 @@ static bool idle_sync_now(struct mailbox *box, struct cmd_idle_context *ctx) { i_assert(ctx->sync_ctx == NULL); - if (ctx->to_hibernate != NULL) { - /* hibernation can't happen while sync is running. - the timeout is added back afterwards. */ - timeout_remove(&ctx->to_hibernate); - } + /* hibernation can't happen while sync is running. + the timeout is added back afterwards. */ + timeout_remove(&ctx->to_hibernate); ctx->sync_pending = FALSE; ctx->sync_ctx = imap_sync_init(ctx->client, box, 0, 0); @@ -175,8 +171,7 @@ static void idle_add_keepalive_timeout(struct cmd_idle_context *ctx) ctx->client->user->remote_ip, interval); - if (ctx->keepalive_to != NULL) - timeout_remove(&ctx->keepalive_to); + timeout_remove(&ctx->keepalive_to); ctx->keepalive_to = timeout_add(interval, keepalive_timeout, ctx); } diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 0efc4e9cc8..9e2fc68f9d 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -433,10 +433,8 @@ static void client_default_destroy(struct client *client, const char *reason) if (client->free_parser != NULL) imap_parser_unref(&client->free_parser); io_remove(&client->io); - if (client->to_idle_output != NULL) - timeout_remove(&client->to_idle_output); - if (client->to_delayed_input != NULL) - timeout_remove(&client->to_delayed_input); + timeout_remove(&client->to_idle_output); + timeout_remove(&client->to_delayed_input); timeout_remove(&client->to_idle); /* i/ostreams are already closed at this stage, so fd can be closed */ @@ -498,8 +496,7 @@ void client_disconnect(struct client *client, const char *reason) i_stream_close(client->input); o_stream_close(client->output); - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); client->to_idle = timeout_add(0, client_destroy_timeout, client); } @@ -915,8 +912,7 @@ void client_command_free(struct client_command_context **_cmd) if (client->command_queue == NULL) { /* no commands left in the queue, we can clear the pool */ p_clear(client->command_pool); - if (client->to_idle_output != NULL) - timeout_remove(&client->to_idle_output); + timeout_remove(&client->to_idle_output); } imap_client_notify_command_freed(client); imap_refresh_proctitle(); @@ -1233,8 +1229,7 @@ void client_input(struct client *client) client->last_input = ioloop_time; timeout_reset(client->to_idle); - if (client->to_delayed_input != NULL) - timeout_remove(&client->to_delayed_input); + timeout_remove(&client->to_delayed_input); bytes = i_stream_read(client->input); if (bytes == -1) { diff --git a/src/imap/imap-notify.c b/src/imap/imap-notify.c index dd0e5fd8aa..306cc5bef0 100644 --- a/src/imap/imap-notify.c +++ b/src/imap/imap-notify.c @@ -501,8 +501,7 @@ void imap_notify_deinit(struct imap_notify_context **_ctx) if (notify_ns->notify != NULL) mailbox_list_notify_deinit(¬ify_ns->notify); } - if (ctx->to_watch != NULL) - timeout_remove(&ctx->to_watch); + timeout_remove(&ctx->to_watch); if (ctx->fetch_ctx != NULL) imap_fetch_free(&ctx->fetch_ctx); pool_unref(&ctx->pool); diff --git a/src/imap/imap-search.c b/src/imap/imap-search.c index f895ca12e7..0b608b844f 100644 --- a/src/imap/imap-search.c +++ b/src/imap/imap-search.c @@ -631,8 +631,7 @@ static int imap_search_deinit(struct imap_search_context *ctx) (void)mailbox_transaction_commit(&ctx->trans); - if (ctx->to != NULL) - timeout_remove(&ctx->to); + timeout_remove(&ctx->to); if (array_is_created(&ctx->relevancy_scores)) array_free(&ctx->relevancy_scores); array_free(&ctx->result); diff --git a/src/indexer/indexer.c b/src/indexer/indexer.c index a30c16d4b1..8de1cae912 100644 --- a/src/indexer/indexer.c +++ b/src/indexer/indexer.c @@ -61,8 +61,7 @@ static void queue_try_send_more(struct indexer_queue *queue) struct worker_connection *conn; struct indexer_request *request; - if (to_send_more != NULL) - timeout_remove(&to_send_more); + timeout_remove(&to_send_more); while ((request = indexer_queue_request_peek(queue)) != NULL) { conn = worker_pool_find_username_connection(worker_pool, @@ -139,8 +138,7 @@ int main(int argc, char *argv[]) indexer_clients_destroy_all(); worker_pool_deinit(&worker_pool); indexer_queue_deinit(&queue); - if (to_send_more != NULL) - timeout_remove(&to_send_more); + timeout_remove(&to_send_more); master_service_deinit(&master_service); return 0; diff --git a/src/lib-auth/auth-master.c b/src/lib-auth/auth-master.c index 0b611c3174..85b0790e34 100644 --- a/src/lib-auth/auth-master.c +++ b/src/lib-auth/auth-master.c @@ -82,8 +82,7 @@ auth_master_init(const char *auth_socket_path, enum auth_master_flags flags) static void auth_connection_close(struct auth_master_connection *conn) { - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); if (conn->fd != -1) { if (close(conn->fd) < 0) i_error("close(%s) failed: %m", conn->auth_socket_path); @@ -338,8 +337,7 @@ static void auth_master_set_io(struct auth_master_connection *conn) if (conn->ioloop != NULL) return; - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); conn->prev_ioloop = current_ioloop; conn->ioloop = io_loop_create(); diff --git a/src/lib-auth/auth-server-connection.c b/src/lib-auth/auth-server-connection.c index 71d2df1550..d3ca908890 100644 --- a/src/lib-auth/auth-server-connection.c +++ b/src/lib-auth/auth-server-connection.c @@ -120,8 +120,7 @@ static int auth_server_input_done(struct auth_server_connection *conn) return -1; } - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); conn->handshake_received = TRUE; if (conn->client->connect_notify_callback != NULL) { @@ -357,8 +356,7 @@ void auth_server_connection_disconnect(struct auth_server_connection *conn, conn->cookie = NULL; array_clear(&conn->available_auth_mechs); - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); io_remove(&conn->io); if (conn->fd != -1) { i_stream_destroy(&conn->input); @@ -425,8 +423,7 @@ int auth_server_connection_connect(struct auth_server_connection *conn) i_assert(conn->fd == -1); conn->last_connect = ioloop_time; - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); /* max. 1 second wait here. */ fd = net_connect_unix_with_retries(conn->client->auth_socket_path, diff --git a/src/lib-dict/dict-client.c b/src/lib-dict/dict-client.c index 158fed1363..e425d0406c 100644 --- a/src/lib-dict/dict-client.c +++ b/src/lib-dict/dict-client.c @@ -314,8 +314,7 @@ client_dict_cmd_send(struct client_dict *dict, struct client_dict_cmd **_cmd, /* we're no longer idling. even with no_replies=TRUE we're going to wait for COMMIT/ROLLBACK. */ - if (dict->to_idle != NULL) - timeout_remove(&dict->to_idle); + timeout_remove(&dict->to_idle); if (client_dict_connect(dict, &error) < 0) { retry = FALSE; @@ -441,14 +440,12 @@ static void client_dict_add_timeout(struct client_dict *dict) } else if (client_dict_is_finished(dict)) { dict->to_idle = timeout_add(dict->idle_msecs, client_dict_timeout, dict); - if (dict->to_requests != NULL) - timeout_remove(&dict->to_requests); + timeout_remove(&dict->to_requests); } else if (dict->transactions == NULL && !client_dict_have_nonbackground_cmds(dict)) { /* we had non-background commands, but now we're back to having only background commands. remove timeouts. */ - if (dict->to_requests != NULL) - timeout_remove(&dict->to_requests); + timeout_remove(&dict->to_requests); } } @@ -633,10 +630,8 @@ static void client_dict_disconnect(struct client_dict *dict, const char *reason) ctx->error = i_strdup(reason); } - if (dict->to_idle != NULL) - timeout_remove(&dict->to_idle); - if (dict->to_requests != NULL) - timeout_remove(&dict->to_requests); + timeout_remove(&dict->to_idle); + timeout_remove(&dict->to_requests); connection_disconnect(&dict->conn.conn); } diff --git a/src/lib-dns/dns-lookup.c b/src/lib-dns/dns-lookup.c index 3866dfa1f5..c67a20e1f4 100644 --- a/src/lib-dns/dns-lookup.c +++ b/src/lib-dns/dns-lookup.c @@ -59,8 +59,7 @@ static void dns_client_disconnect(struct dns_client *client, const char *error) struct dns_lookup *lookup, *next; struct dns_lookup_result result; - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); io_remove(&client->io); if (client->input != NULL) i_stream_destroy(&client->input); @@ -239,8 +238,7 @@ static void dns_lookup_free(struct dns_lookup **_lookup) *_lookup = NULL; DLLIST2_REMOVE(&client->head, &client->tail, lookup); - if (lookup->to != NULL) - timeout_remove(&lookup->to); + timeout_remove(&lookup->to); i_free(lookup->name); i_free(lookup->ips); if (client->deinit_client_at_free) @@ -365,8 +363,7 @@ dns_client_lookup_common(struct dns_client *client, if (gettimeofday(&lookup->start_time, NULL) < 0) i_fatal("gettimeofday() failed: %m"); - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); DLLIST2_APPEND(&client->head, &client->tail, lookup); *lookup_r = lookup; return 0; diff --git a/src/lib-http/http-client-connection.c b/src/lib-http/http-client-connection.c index 814de2b40f..ab0c5c1e8c 100644 --- a/src/lib-http/http-client-connection.c +++ b/src/lib-http/http-client-connection.c @@ -443,8 +443,7 @@ void http_client_connection_reset_request_timeout( void http_client_connection_stop_request_timeout( struct http_client_connection *conn) { - if (conn->to_requests != NULL) - timeout_remove(&conn->to_requests); + timeout_remove(&conn->to_requests); } static void @@ -457,8 +456,7 @@ http_client_connection_continue_timeout(struct http_client_connection *conn) i_assert(conn->pending_request == NULL); - if (conn->to_response != NULL) - timeout_remove(&conn->to_response); + timeout_remove(&conn->to_response); conn->peer->no_payload_sync = TRUE; http_client_connection_debug(conn, @@ -499,8 +497,7 @@ int http_client_connection_next_request(struct http_client_connection *conn) i_assert(req->state == HTTP_REQUEST_STATE_QUEUED); - if (conn->to_idle != NULL) - timeout_remove(&conn->to_idle); + timeout_remove(&conn->to_idle); req->payload_sync_continue = FALSE; if (conn->peer->no_payload_sync) @@ -873,8 +870,7 @@ static void http_client_connection_input(struct connection *_conn) req->response_time = ioloop_timeval; /* Got some response; cancel response timeout */ - if (conn->to_response != NULL) - timeout_remove(&conn->to_response); + timeout_remove(&conn->to_response); /* RFC 7231, Section 6.2: @@ -1164,8 +1160,7 @@ http_client_connection_ready(struct http_client_connection *conn) /* connected */ conn->connected = TRUE; conn->last_ioloop = current_ioloop; - if (conn->to_connect != NULL) - timeout_remove(&conn->to_connect); + timeout_remove(&conn->to_connect); /* indicate connection success */ conn->connect_succeeded = TRUE; @@ -1547,16 +1542,11 @@ http_client_connection_disconnect(struct http_client_connection *conn) connection_disconnect(&conn->conn); io_remove(&conn->io_req_payload); - if (conn->to_requests != NULL) - timeout_remove(&conn->to_requests); - if (conn->to_connect != NULL) - timeout_remove(&conn->to_connect); - if (conn->to_input != NULL) - timeout_remove(&conn->to_input); - if (conn->to_idle != NULL) - timeout_remove(&conn->to_idle); - if (conn->to_response != NULL) - timeout_remove(&conn->to_response); + timeout_remove(&conn->to_requests); + timeout_remove(&conn->to_connect); + timeout_remove(&conn->to_input); + timeout_remove(&conn->to_idle); + timeout_remove(&conn->to_response); /* remove this connection from the list */ conn_arr = &peer->conns; diff --git a/src/lib-http/http-client-host.c b/src/lib-http/http-client-host.c index ebe4cd25ba..d3c3a63e4e 100644 --- a/src/lib-http/http-client-host.c +++ b/src/lib-http/http-client-host.c @@ -255,8 +255,7 @@ void http_client_host_submit_request(struct http_client_host *host, http_client_queue_submit_request(queue, req); /* cancel host idle timeout */ - if (host->to_idle != NULL) - timeout_remove(&host->to_idle); + timeout_remove(&host->to_idle); if (host->unix_local) { http_client_queue_connection_setup(queue); diff --git a/src/lib-http/http-client-peer.c b/src/lib-http/http-client-peer.c index 306e4a8318..1de86455c1 100644 --- a/src/lib-http/http-client-peer.c +++ b/src/lib-http/http-client-peer.c @@ -200,8 +200,7 @@ http_client_peer_reset_backoff_timer(struct http_client_peer *peer) { peer->backoff_time_msecs = 0; - if (peer->to_backoff != NULL) - timeout_remove(&peer->to_backoff); + timeout_remove(&peer->to_backoff); } static void diff --git a/src/lib-http/http-client-queue.c b/src/lib-http/http-client-queue.c index ebd7c8398e..8e6883f3b0 100644 --- a/src/lib-http/http-client-queue.c +++ b/src/lib-http/http-client-queue.c @@ -274,8 +274,7 @@ http_client_queue_soft_connect_timeout(struct http_client_queue *queue) i_assert(queue->addr.type != HTTP_CLIENT_PEER_ADDR_UNIX); - if (queue->to_connect != NULL) - timeout_remove(&queue->to_connect); + timeout_remove(&queue->to_connect); if (http_client_queue_is_last_connect_ip(queue)) { /* no more IPs to try */ @@ -316,8 +315,7 @@ http_client_queue_connection_attempt(struct http_client_queue *queue) /* check whether host IPs are still up-to-date */ if ((ret=http_client_host_refresh(host)) < 0) { /* performing asynchronous lookup */ - if (queue->to_connect != NULL) - timeout_remove(&queue->to_connect); + timeout_remove(&queue->to_connect); return NULL; } if (ret > 0) { @@ -468,8 +466,7 @@ http_client_queue_connection_success(struct http_client_queue *queue, queue->connect_attempts = 0; /* stop soft connect time-out */ - if (queue->to_connect != NULL) - timeout_remove(&queue->to_connect); + timeout_remove(&queue->to_connect); /* drop all other attempts to the hport. note that we get here whenever a connection is successfully created, so pending_peers array @@ -560,8 +557,7 @@ http_client_queue_connection_failure(struct http_client_queue *queue, /* one of the connections failed. if we're not using soft timeouts, we need to try to connect to the next IP. if we are using soft timeouts, we've already tried all of the IPs by now. */ - if (queue->to_connect != NULL) - timeout_remove(&queue->to_connect); + timeout_remove(&queue->to_connect); if (queue->addr.type == HTTP_CLIENT_PEER_ADDR_UNIX) { http_client_queue_fail(queue, @@ -766,8 +762,7 @@ http_client_queue_set_request_timer(struct http_client_queue *queue, const struct timeval *time) { i_assert(time->tv_sec > 0); - if (queue->to_request != NULL) - timeout_remove(&queue->to_request); + timeout_remove(&queue->to_request); if (queue->client->set.debug) { http_client_queue_debug(queue, @@ -890,8 +885,7 @@ http_client_queue_set_delay_timer(struct http_client_queue *queue, msecs = (usecs + 999) / 1000; /* set timer */ - if (queue->to_delayed != NULL) - timeout_remove(&queue->to_delayed); + timeout_remove(&queue->to_delayed); queue->to_delayed = timeout_add (msecs, http_client_queue_delay_timeout, queue); } diff --git a/src/lib-http/http-client.c b/src/lib-http/http-client.c index 6f36c4c5d3..ee1628b171 100644 --- a/src/lib-http/http-client.c +++ b/src/lib-http/http-client.c @@ -196,8 +196,7 @@ void http_client_deinit(struct http_client **_client) hash_table_destroy(&client->hosts); array_free(&client->delayed_failing_requests); - if (client->to_failing_requests != NULL) - timeout_remove(&client->to_failing_requests); + timeout_remove(&client->to_failing_requests); connection_list_deinit(&client->conn_list); diff --git a/src/lib-http/http-server-connection.c b/src/lib-http/http-server-connection.c index c471b096bd..c17df3c205 100644 --- a/src/lib-http/http-server-connection.c +++ b/src/lib-http/http-server-connection.c @@ -131,8 +131,7 @@ http_server_connection_idle_timeout(struct http_server_connection *conn) static void http_server_connection_timeout_stop(struct http_server_connection *conn) { - if (conn->to_idle != NULL) - timeout_remove(&conn->to_idle); + timeout_remove(&conn->to_idle); } static void @@ -1164,8 +1163,7 @@ http_server_connection_disconnect(struct http_server_connection *conn, req = req_next; } - if (conn->to_input != NULL) - timeout_remove(&conn->to_input); + timeout_remove(&conn->to_input); http_server_connection_timeout_stop(conn); io_remove(&conn->io_resp_payload); diff --git a/src/lib-http/test-http-client-errors.c b/src/lib-http/test-http-client-errors.c index 15bc4f78b5..0c0bfc10f6 100644 --- a/src/lib-http/test-http-client-errors.c +++ b/src/lib-http/test-http-client-errors.c @@ -386,8 +386,7 @@ test_client_connection_refused_response( struct _connection_refused *ctx) { test_assert(ctx->to == NULL); - if (ctx->to != NULL) - timeout_remove(&ctx->to); + timeout_remove(&ctx->to); if (debug) i_debug("RESPONSE: %u %s", resp->status, resp->reason); @@ -497,8 +496,7 @@ test_client_connection_lost_prematurely_response( struct _connection_lost_prematurely *ctx) { test_assert(ctx->to == NULL); - if (ctx->to != NULL) - timeout_remove(&ctx->to); + timeout_remove(&ctx->to); if (debug) i_debug("RESPONSE: %u %s", resp->status, resp->reason); @@ -1675,8 +1673,7 @@ static void test_client_request_timed_out2_timeout( struct _request_timed_out2_ctx *ctx) { - if (ctx->to != NULL) - timeout_remove(&ctx->to); + timeout_remove(&ctx->to); i_debug("TIMEOUT"); } @@ -1696,8 +1693,7 @@ test_client_request_timed_out2_response( if (ctx->to != NULL && ctx->max_parallel_connections <= 1) timeout_reset(ctx->to); } else { - if (ctx->to != NULL) - timeout_remove(&ctx->to); + timeout_remove(&ctx->to); i_free(ctx); io_loop_stop(ioloop); } diff --git a/src/lib-http/test-http-server-errors.c b/src/lib-http/test-http-server-errors.c index 1fb4d6f3ff..81db670d4d 100644 --- a/src/lib-http/test-http-server-errors.c +++ b/src/lib-http/test-http-server-errors.c @@ -119,8 +119,7 @@ static void test_server_slow_request_destroyed(struct _slow_request *ctx) { test_assert(ctx->serviced); - if (ctx->to_delay != NULL) - timeout_remove(&ctx->to_delay); + timeout_remove(&ctx->to_delay); i_free(ctx); io_loop_stop(ioloop); } diff --git a/src/lib-imap-client/imapc-client.c b/src/lib-imap-client/imapc-client.c index 0918b66afb..96f51b0305 100644 --- a/src/lib-imap-client/imapc-client.c +++ b/src/lib-imap-client/imapc-client.c @@ -442,8 +442,7 @@ void imapc_client_mailbox_close(struct imapc_client_mailbox **_box) } imapc_msgmap_deinit(&box->msgmap); - if (box->to_send_idle != NULL) - timeout_remove(&box->to_send_idle); + timeout_remove(&box->to_send_idle); i_free(box); } diff --git a/src/lib-imap-client/imapc-connection.c b/src/lib-imap-client/imapc-connection.c index ba503527c6..dde95b66bc 100644 --- a/src/lib-imap-client/imapc-connection.c +++ b/src/lib-imap-client/imapc-connection.c @@ -426,8 +426,7 @@ void imapc_connection_disconnect_full(struct imapc_connection *conn, bool reconnecting) { /* timeout may be set also in disconnected state */ - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); conn->reconnecting = reconnecting; if (conn->state == IMAPC_CONNECTION_STATE_DISCONNECTED) @@ -440,12 +439,9 @@ void imapc_connection_disconnect_full(struct imapc_connection *conn, dns_lookup_abort(&conn->dns_lookup); imapc_connection_lfiles_free(conn); imapc_connection_literal_reset(&conn->literal); - if (conn->to_output != NULL) - timeout_remove(&conn->to_output); - if (conn->to_throttle != NULL) - timeout_remove(&conn->to_throttle); - if (conn->to_throttle_shrink != NULL) - timeout_remove(&conn->to_throttle_shrink); + timeout_remove(&conn->to_output); + timeout_remove(&conn->to_throttle); + timeout_remove(&conn->to_throttle_shrink); if (conn->parser != NULL) imap_parser_unref(&conn->parser); io_remove(&conn->io); @@ -1320,8 +1316,7 @@ static void imapc_connection_throttle(struct imapc_connection *conn, const struct imapc_command_reply *reply) { - if (conn->to_throttle != NULL) - timeout_remove(&conn->to_throttle); + timeout_remove(&conn->to_throttle); /* If GMail returns [THROTTLED], start slowing down commands. Unfortunately this isn't a nice resp-text-code, but just @@ -2084,8 +2079,7 @@ static void imapc_connection_set_selecting(struct imapc_client_mailbox *box) static bool imapc_connection_is_throttled(struct imapc_connection *conn) { - if (conn->to_throttle != NULL) - timeout_remove(&conn->to_throttle); + timeout_remove(&conn->to_throttle); if (conn->throttle_msecs == 0) { /* we haven't received [THROTTLED] recently */ @@ -2168,8 +2162,7 @@ static void imapc_command_send_more(struct imapc_connection *conn) (pre-login has its own timeout) */ if ((cmd->flags & IMAPC_COMMAND_FLAG_LOGOUT) != 0) { /* LOGOUT has a shorter timeout */ - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); conn->to = timeout_add(IMAPC_LOGOUT_TIMEOUT_MSECS, imapc_command_timeout, conn); } else if (conn->to == NULL) { diff --git a/src/lib-imap-urlauth/imap-urlauth-connection.c b/src/lib-imap-urlauth/imap-urlauth-connection.c index 1047a5e25d..9af54a4cf4 100644 --- a/src/lib-imap-urlauth/imap-urlauth-connection.c +++ b/src/lib-imap-urlauth/imap-urlauth-connection.c @@ -145,8 +145,7 @@ void imap_urlauth_connection_deinit(struct imap_urlauth_connection **_conn) static void imap_urlauth_stop_response_timeout(struct imap_urlauth_connection *conn) { - if (conn->to_response != NULL) - timeout_remove(&conn->to_response); + timeout_remove(&conn->to_response); } static void @@ -218,8 +217,7 @@ imap_urlauth_connection_send_request(struct imap_urlauth_connection *conn) conn->state == IMAP_URLAUTH_STATE_READY)) { if (conn->user->mail_debug) i_debug("imap-urlauth: No more requests pending; scheduling disconnect"); - if (conn->to_idle != NULL) - timeout_remove(&conn->to_idle); + timeout_remove(&conn->to_idle); if (conn->idle_timeout_msecs > 0) { conn->to_idle = timeout_add(conn->idle_timeout_msecs, imap_urlauth_connection_idle_disconnect, conn); @@ -295,8 +293,7 @@ imap_urlauth_request_new(struct imap_urlauth_connection *conn, DLLIST2_APPEND(&target->requests_head, &target->requests_tail, urlreq); - if (conn->to_idle != NULL) - timeout_remove(&conn->to_idle); + timeout_remove(&conn->to_idle); if (conn->user->mail_debug) { i_debug("imap-urlauth: Added request for URL `%s' from user `%s'", @@ -911,8 +908,7 @@ imap_urlauth_connection_do_connect(struct imap_urlauth_connection *conn) return -1; } - if (conn->to_reconnect != NULL) - timeout_remove(&conn->to_reconnect); + timeout_remove(&conn->to_reconnect); conn->fd = fd; conn->input = i_stream_create_fd(fd, (size_t)-1); @@ -979,10 +975,8 @@ static void imap_urlauth_connection_disconnect if (conn->literal_buf != NULL) buffer_free(&conn->literal_buf); - if (conn->to_reconnect != NULL) - timeout_remove(&conn->to_reconnect); - if (conn->to_idle != NULL) - timeout_remove(&conn->to_idle); + timeout_remove(&conn->to_reconnect); + timeout_remove(&conn->to_idle); imap_urlauth_stop_response_timeout(conn); } @@ -998,8 +992,7 @@ imap_urlauth_connection_do_reconnect(struct imap_urlauth_connection *conn) if (ioloop_time - conn->last_reconnect < IMAP_URLAUTH_RECONNECT_MIN_SECS) { if (conn->user->mail_debug) i_debug("imap-urlauth: Scheduling reconnect"); - if (conn->to_reconnect != NULL) - timeout_remove(&conn->to_reconnect); + timeout_remove(&conn->to_reconnect); conn->to_reconnect = timeout_add(IMAP_URLAUTH_RECONNECT_MIN_SECS*1000, imap_urlauth_connection_do_reconnect, conn); diff --git a/src/lib-ldap/ldap-connection.c b/src/lib-ldap/ldap-connection.c index e9991a92b9..546777849f 100644 --- a/src/lib-ldap/ldap-connection.c +++ b/src/lib-ldap/ldap-connection.c @@ -32,8 +32,7 @@ void ldap_connection_deinit(struct ldap_connection **_conn) struct ldap_op_queue_entry *const *reqp = array_idx(&(conn->request_array), aqueue_idx(conn->request_queue, i)); - if ((*reqp)->to_abort != NULL) - timeout_remove(&(*reqp)->to_abort); + timeout_remove(&(*reqp)->to_abort); } pool_unref(&conn->pool); } @@ -300,8 +299,7 @@ void ldap_connection_request_destroy(struct ldap_op_queue_entry **_req) *_req = NULL; - if (req->to_abort != NULL) - timeout_remove(&req->to_abort); + timeout_remove(&req->to_abort); pool_unref(&req->pool); } @@ -413,8 +411,7 @@ void ldap_connection_abort_request(struct ldap_op_queue_entry *req) struct ldap_result res; /* too bad */ - if (req->to_abort != NULL) - timeout_remove(&req->to_abort); + timeout_remove(&req->to_abort); if (req->msgid > -1) ldap_abandon_ext(req->conn->conn, req->msgid, NULL, NULL); @@ -451,8 +448,7 @@ void ldap_connection_abort_all_requests(struct ldap_connection *conn) struct ldap_op_queue_entry **reqp = array_idx_modifiable(&(conn->request_array), aqueue_idx(conn->request_queue, i)); - if ((*reqp)->to_abort != NULL) - timeout_remove(&(*reqp)->to_abort); + timeout_remove(&(*reqp)->to_abort); if ((*reqp)->result_callback != NULL) (*reqp)->result_callback(&res, (*reqp)->result_callback_ctx); ldap_connection_request_destroy(reqp); diff --git a/src/lib-master/anvil-client.c b/src/lib-master/anvil-client.c index 5d34030b13..2874a8b910 100644 --- a/src/lib-master/anvil-client.c +++ b/src/lib-master/anvil-client.c @@ -144,8 +144,7 @@ int anvil_client_connect(struct anvil_client *client, bool retry) return -1; } - if (client->to_reconnect != NULL) - timeout_remove(&client->to_reconnect); + timeout_remove(&client->to_reconnect); client->fd = fd; client->input = i_stream_create_fd(fd, ANVIL_INBUF_SIZE); @@ -173,8 +172,7 @@ static void anvil_client_cancel_queries(struct anvil_client *client) i_free(query); aqueue_delete_tail(client->queries); } - if (client->to_query != NULL) - timeout_remove(&client->to_query); + timeout_remove(&client->to_query); } static void anvil_client_disconnect(struct anvil_client *client) @@ -187,8 +185,7 @@ static void anvil_client_disconnect(struct anvil_client *client) net_disconnect(client->fd); client->fd = -1; } - if (client->to_reconnect != NULL) - timeout_remove(&client->to_reconnect); + timeout_remove(&client->to_reconnect); } static void anvil_client_timeout(struct anvil_client *client) diff --git a/src/lib-master/ipc-server.c b/src/lib-master/ipc-server.c index 86619188f5..0ccc76a244 100644 --- a/src/lib-master/ipc-server.c +++ b/src/lib-master/ipc-server.c @@ -97,8 +97,7 @@ static void ipc_server_connect(struct ipc_server *server) { i_assert(server->fd == -1); - if (server->to != NULL) - timeout_remove(&server->to); + timeout_remove(&server->to); server->fd = net_connect_unix(server->path); if (server->fd == -1) { @@ -154,8 +153,7 @@ void ipc_server_deinit(struct ipc_server **_server) i_assert(server->ipc_cmd_refcount == 0); ipc_server_disconnect(server); - if (server->to != NULL) - timeout_remove(&server->to); + timeout_remove(&server->to); i_free(server->name); i_free(server->path); i_free(server); diff --git a/src/lib-master/master-auth.c b/src/lib-master/master-auth.c index de476ab715..59243a3d2f 100644 --- a/src/lib-master/master-auth.c +++ b/src/lib-master/master-auth.c @@ -69,8 +69,7 @@ master_auth_connection_deinit(struct master_auth_connection **_conn) if (conn->callback != NULL) conn->callback(NULL, conn->context); - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); io_remove(&conn->io); if (conn->fd != -1) { if (close(conn->fd) < 0) diff --git a/src/lib-master/master-login-auth.c b/src/lib-master/master-login-auth.c index 5f6dfd57b8..ad6a14f1ba 100644 --- a/src/lib-master/master-login-auth.c +++ b/src/lib-master/master-login-auth.c @@ -105,8 +105,7 @@ void master_login_auth_disconnect(struct master_login_auth *auth) } hash_table_clear(auth->requests, FALSE); - if (auth->to != NULL) - timeout_remove(&auth->to); + timeout_remove(&auth->to); io_remove(&auth->io); if (auth->fd != -1) { if (auth->input != NULL) diff --git a/src/lib-master/master-service-haproxy.c b/src/lib-master/master-service-haproxy.c index 4438b5925d..73d7fc2af3 100644 --- a/src/lib-master/master-service-haproxy.c +++ b/src/lib-master/master-service-haproxy.c @@ -77,8 +77,7 @@ master_service_haproxy_conn_free(struct master_service_haproxy_conn *hpconn) DLLIST_REMOVE(&service->haproxy_conns, hpconn); io_remove(&hpconn->io); - if (hpconn->to != NULL) - timeout_remove(&hpconn->to); + timeout_remove(&hpconn->to); i_free(hpconn); } diff --git a/src/lib-master/master-service.c b/src/lib-master/master-service.c index 6e66917abd..4c669074e2 100644 --- a/src/lib-master/master-service.c +++ b/src/lib-master/master-service.c @@ -893,8 +893,7 @@ void master_service_client_connection_destroyed(struct master_service *service) static void master_service_set_login_state(struct master_service *service, enum master_login_state state) { - if (service->to_overflow_state != NULL) - timeout_remove(&service->to_overflow_state); + timeout_remove(&service->to_overflow_state); switch (state) { case MASTER_LOGIN_STATE_NONFULL: @@ -953,12 +952,9 @@ void master_service_deinit(struct master_service **_service) master_service_ssl_ctx_deinit(service); master_service_close_config_fd(service); - if (service->to_die != NULL) - timeout_remove(&service->to_die); - if (service->to_overflow_state != NULL) - timeout_remove(&service->to_overflow_state); - if (service->to_status != NULL) - timeout_remove(&service->to_status); + timeout_remove(&service->to_die); + timeout_remove(&service->to_overflow_state); + timeout_remove(&service->to_status); io_remove(&service->io_status_error); io_remove(&service->io_status_write); if (array_is_created(&service->config_overrides)) @@ -1120,8 +1116,7 @@ master_status_send(struct master_service *service, bool important_update) { ssize_t ret; - if (service->to_status != NULL) - timeout_remove(&service->to_status); + timeout_remove(&service->to_status); ret = write(MASTER_STATUS_FD, &service->master_status, sizeof(service->master_status)); diff --git a/src/lib-oauth2/oauth2.c b/src/lib-oauth2/oauth2.c index a694dbf7ab..760f8a7c76 100644 --- a/src/lib-oauth2/oauth2.c +++ b/src/lib-oauth2/oauth2.c @@ -79,8 +79,7 @@ oauth2_request_abort(struct oauth2_request **_req) void oauth2_request_free_internal(struct oauth2_request *req) { - if (req->to_delayed_error != NULL) - timeout_remove(&req->to_delayed_error); + timeout_remove(&req->to_delayed_error); pool_unref(&req->pool); } diff --git a/src/lib-program-client/program-client-local.c b/src/lib-program-client/program-client-local.c index f86557270b..29925a64bc 100644 --- a/src/lib-program-client/program-client-local.c +++ b/src/lib-program-client/program-client-local.c @@ -296,8 +296,7 @@ int program_client_local_close_output(struct program_client *pclient) static void program_client_local_exited(struct program_client_local *plclient) { - if (plclient->to_kill != NULL) - timeout_remove(&plclient->to_kill); + timeout_remove(&plclient->to_kill); if (plclient->child_wait != NULL) child_wait_free(&plclient->child_wait); @@ -344,8 +343,7 @@ static void program_client_local_kill(struct program_client_local *plclient) { /* time to die */ - if (plclient->to_kill != NULL) - timeout_remove(&plclient->to_kill); + timeout_remove(&plclient->to_kill); i_assert(plclient->pid != (pid_t)-1); diff --git a/src/lib-program-client/program-client-remote.c b/src/lib-program-client/program-client-remote.c index 4e30f3d9bb..2f986c369f 100644 --- a/src/lib-program-client/program-client-remote.c +++ b/src/lib-program-client/program-client-remote.c @@ -282,8 +282,7 @@ int program_client_unix_connect(struct program_client *pclient) if (pclient->set.debug) i_debug("Trying to connect %s", pclient->path); - if (prclient->to_retry != NULL) - timeout_remove(&prclient->to_retry); + timeout_remove(&prclient->to_retry); if ((fd = net_connect_unix(pclient->path)) < 0) { switch (errno) { @@ -355,11 +354,9 @@ void program_client_net_connect_real(struct program_client *pclient) struct program_client_remote *prclient = (struct program_client_remote *) pclient; - if (pclient->to != NULL) - timeout_remove(&pclient->to); + timeout_remove(&pclient->to); - if (prclient->to_retry != NULL) - timeout_remove(&prclient->to_retry); + timeout_remove(&prclient->to_retry); i_assert(prclient->ips_count > 0); @@ -545,8 +542,7 @@ void program_client_remote_disconnect(struct program_client *pclient, bool force struct program_client_remote *prclient = (struct program_client_remote *)pclient; - if (prclient->to_retry != NULL) - timeout_remove(&prclient->to_retry); + timeout_remove(&prclient->to_retry); if (pclient->error == PROGRAM_CLIENT_ERROR_NONE && !prclient->noreply && pclient->program_input != NULL && !force) { diff --git a/src/lib-program-client/program-client.c b/src/lib-program-client/program-client.c index 09517e8c90..f8240fd436 100644 --- a/src/lib-program-client/program-client.c +++ b/src/lib-program-client/program-client.c @@ -160,8 +160,7 @@ void program_client_disconnect(struct program_client *pclient, bool force) return; pclient->disconnected = TRUE; - if (pclient->to != NULL) - timeout_remove(&pclient->to); + timeout_remove(&pclient->to); io_remove(&pclient->io); if ((ret = program_client_close_output(pclient)) < 0) @@ -404,8 +403,7 @@ int program_client_connected(struct program_client *pclient) int ret = 1; pclient->start_time = ioloop_timeval; - if (pclient->to != NULL) - timeout_remove(&pclient->to); + timeout_remove(&pclient->to); if (pclient->set.input_idle_timeout_msecs != 0) { pclient->to = timeout_add(pclient->set.input_idle_timeout_msecs, diff --git a/src/lib-smtp/lmtp-client.c b/src/lib-smtp/lmtp-client.c index c8bdc5190f..02a30f6cef 100644 --- a/src/lib-smtp/lmtp-client.c +++ b/src/lib-smtp/lmtp-client.c @@ -118,8 +118,7 @@ void lmtp_client_close(struct lmtp_client *client) { if (client->dns_lookup != NULL) dns_lookup_abort(&client->dns_lookup); - if (client->to != NULL) - timeout_remove(&client->to); + timeout_remove(&client->to); io_remove(&client->io); if (client->input != NULL) i_stream_close(client->input); @@ -867,10 +866,8 @@ void lmtp_client_send(struct lmtp_client *client, struct istream *data_input) /* now we actually want to start doing I/O. start the timeout handling. */ if (client->set.timeout_secs > 0) { - if (client->to != NULL) { - /* still waiting for connect to finish */ - timeout_remove(&client->to); - } + /* possibly still waiting for connect to finish */ + timeout_remove(&client->to); client->to = timeout_add(client->set.timeout_secs*1000, lmtp_client_timeout, client); } diff --git a/src/lib-sql/driver-cassandra.c b/src/lib-sql/driver-cassandra.c index 9c55750d8b..4f81d40e2c 100644 --- a/src/lib-sql/driver-cassandra.c +++ b/src/lib-sql/driver-cassandra.c @@ -735,8 +735,7 @@ static void driver_cassandra_deinit_v(struct sql_db *_db) cass_session_free(db->session); cass_cluster_free(db->cluster); cass_timestamp_gen_free(db->timestamp_gen); - if (db->to_metrics != NULL) - timeout_remove(&db->to_metrics); + timeout_remove(&db->to_metrics); i_free(db->metrics_path); i_free(db->hosts); i_free(db->error); diff --git a/src/lib-sql/driver-pgsql.c b/src/lib-sql/driver-pgsql.c index 842dddc395..f1985f094a 100644 --- a/src/lib-sql/driver-pgsql.c +++ b/src/lib-sql/driver-pgsql.c @@ -132,8 +132,7 @@ static void driver_pgsql_close(struct pgsql_db *db) PQfinish(db->pg); db->pg = NULL; - if (db->to_connect != NULL) - timeout_remove(&db->to_connect); + timeout_remove(&db->to_connect); driver_pgsql_set_state(db, SQL_DB_STATE_DISCONNECTED); @@ -194,8 +193,7 @@ static void connect_callback(struct pgsql_db *db) if (io_dir == 0) { db->connect_state = "connected"; - if (db->to_connect != NULL) - timeout_remove(&db->to_connect); + timeout_remove(&db->to_connect); driver_pgsql_set_state(db, SQL_DB_STATE_IDLE); if (db->ioloop != NULL) { /* driver_pgsql_sync_init() waiting for connection to diff --git a/src/lib-sql/driver-sqlpool.c b/src/lib-sql/driver-sqlpool.c index dfc0450fb8..18b224eac6 100644 --- a/src/lib-sql/driver-sqlpool.c +++ b/src/lib-sql/driver-sqlpool.c @@ -227,8 +227,7 @@ sqlpool_handle_connect_failed(struct sqlpool_db *db, struct sql_db *conndb) conndb->connect_failure_count++; /* reconnect after the delay */ - if (conndb->to_reconnect != NULL) - timeout_remove(&conndb->to_reconnect); + timeout_remove(&conndb->to_reconnect); conndb->to_reconnect = timeout_add(conndb->connect_delay * 1000, sqlpool_reconnect, conndb); @@ -493,8 +492,7 @@ static void driver_sqlpool_abort_requests(struct sqlpool_db *db) sqlpool_request_abort(&request); } - if (db->request_to != NULL) - timeout_remove(&db->request_to); + timeout_remove(&db->request_to); } static void driver_sqlpool_deinit(struct sql_db *_db) diff --git a/src/lib-sql/sql-api.c b/src/lib-sql/sql-api.c index 20e0e270c8..1f07f003d9 100644 --- a/src/lib-sql/sql-api.c +++ b/src/lib-sql/sql-api.c @@ -87,8 +87,7 @@ void sql_deinit(struct sql_db **_db) *_db = NULL; - if (db->to_reconnect != NULL) - timeout_remove(&db->to_reconnect); + timeout_remove(&db->to_reconnect); db->v.deinit(db); } @@ -121,8 +120,7 @@ int sql_connect(struct sql_db *db) void sql_disconnect(struct sql_db *db) { - if (db->to_reconnect != NULL) - timeout_remove(&db->to_reconnect); + timeout_remove(&db->to_reconnect); db->v.disconnect(db); } diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage.c b/src/lib-storage/index/dbox-multi/mdbox-storage.c index ec90f8940d..c1826bb386 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c @@ -71,8 +71,7 @@ void mdbox_storage_destroy(struct mail_storage *_storage) mdbox_files_free(storage); mdbox_map_deinit(&storage->map); - if (storage->to_close_unused_files != NULL) - timeout_remove(&storage->to_close_unused_files); + timeout_remove(&storage->to_close_unused_files); if (array_is_created(&storage->move_from_alt_map_uids)) array_free(&storage->move_from_alt_map_uids); diff --git a/src/lib-storage/index/imapc/imapc-mail-fetch.c b/src/lib-storage/index/imapc/imapc-mail-fetch.c index c19461c483..d428db146d 100644 --- a/src/lib-storage/index/imapc/imapc-mail-fetch.c +++ b/src/lib-storage/index/imapc/imapc-mail-fetch.c @@ -512,8 +512,7 @@ void imapc_mail_fetch_flush(struct imapc_mailbox *mbox) imapc_command_send(cmd, str_c(mbox->pending_fetch_cmd)); mbox->pending_fetch_request = NULL; - if (mbox->to_pending_fetch_send != NULL) - timeout_remove(&mbox->to_pending_fetch_send); + timeout_remove(&mbox->to_pending_fetch_send); str_truncate(mbox->pending_fetch_cmd, 0); } diff --git a/src/lib-storage/index/imapc/imapc-storage.c b/src/lib-storage/index/imapc/imapc-storage.c index 4776e564b8..f09fd0dea4 100644 --- a/src/lib-storage/index/imapc/imapc-storage.c +++ b/src/lib-storage/index/imapc/imapc-storage.c @@ -786,10 +786,8 @@ static void imapc_mailbox_close(struct mailbox *box) array_free(&mbox->rseq_modseqs); if (mbox->sync_view != NULL) mail_index_view_close(&mbox->sync_view); - if (mbox->to_idle_delay != NULL) - timeout_remove(&mbox->to_idle_delay); - if (mbox->to_idle_check != NULL) - timeout_remove(&mbox->to_idle_check); + timeout_remove(&mbox->to_idle_delay); + timeout_remove(&mbox->to_idle_check); imapc_mail_cache_free(&mbox->prev_mail_cache); index_storage_mailbox_close(box); } @@ -1156,8 +1154,7 @@ static void imapc_notify_changes(struct mailbox *box) struct imapc_command *cmd; if (box->notify_callback == NULL) { - if (mbox->to_idle_check != NULL) - timeout_remove(&mbox->to_idle_check); + timeout_remove(&mbox->to_idle_check); return; } diff --git a/src/lib-storage/index/mbox/mbox-storage.c b/src/lib-storage/index/mbox/mbox-storage.c index 344591f557..677854267d 100644 --- a/src/lib-storage/index/mbox/mbox-storage.c +++ b/src/lib-storage/index/mbox/mbox-storage.c @@ -613,8 +613,7 @@ static void mbox_mailbox_close(struct mailbox *box) if (mbox->mbox_global_lock_id != 0) mbox_unlock(mbox, mbox->mbox_global_lock_id); - if (mbox->keep_lock_to != NULL) - timeout_remove(&mbox->keep_lock_to); + timeout_remove(&mbox->keep_lock_to); mbox_file_close(mbox); if (mbox->mbox_file_stream != NULL) diff --git a/src/lib-storage/index/pop3c/pop3c-client.c b/src/lib-storage/index/pop3c/pop3c-client.c index c0f4e43576..dbaef5591c 100644 --- a/src/lib-storage/index/pop3c/pop3c-client.c +++ b/src/lib-storage/index/pop3c/pop3c-client.c @@ -199,8 +199,7 @@ static void pop3c_client_disconnect(struct pop3c_client *client) if (client->dns_lookup != NULL) dns_lookup_abort(&client->dns_lookup); - if (client->to != NULL) - timeout_remove(&client->to); + timeout_remove(&client->to); io_remove(&client->io); if (client->input != NULL) i_stream_destroy(&client->input); diff --git a/src/lib-storage/list/mailbox-list-index-notify.c b/src/lib-storage/list/mailbox-list-index-notify.c index 21c0471e2e..2e3ab60fb8 100644 --- a/src/lib-storage/list/mailbox-list-index-notify.c +++ b/src/lib-storage/list/mailbox-list-index-notify.c @@ -181,10 +181,8 @@ void mailbox_list_index_notify_deinit(struct mailbox_list_notify *notify) mailbox_tree_deinit(&inotify->subscriptions); 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) - timeout_remove(&inotify->to_notify); + timeout_remove(&inotify->to_wait); + timeout_remove(&inotify->to_notify); if (inotify->sync_ctx != NULL) (void)mail_index_view_sync_commit(&inotify->sync_ctx, &b); mail_index_view_close(&inotify->view); @@ -927,10 +925,8 @@ void mailbox_list_index_notify_wait(struct mailbox_list_notify *notify, if (callback == NULL) { 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) - timeout_remove(&inotify->to_notify); + timeout_remove(&inotify->to_wait); + timeout_remove(&inotify->to_notify); } else if (inotify->to_wait == NULL) { (void)io_add_notify(inotify->list_log_path, list_notify_callback, inotify, &inotify->io_wait); diff --git a/src/lib-storage/list/mailbox-list-index.c b/src/lib-storage/list/mailbox-list-index.c index c85308faf2..7b1a48dbcc 100644 --- a/src/lib-storage/list/mailbox-list-index.c +++ b/src/lib-storage/list/mailbox-list-index.c @@ -630,8 +630,7 @@ static void mailbox_list_index_deinit(struct mailbox_list *list) { struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(list); - if (ilist->to_refresh != NULL) - timeout_remove(&ilist->to_refresh); + timeout_remove(&ilist->to_refresh); if (ilist->index != NULL) { hash_table_destroy(&ilist->mailbox_hash); hash_table_destroy(&ilist->mailbox_names); diff --git a/src/lib-storage/mailbox-watch.c b/src/lib-storage/mailbox-watch.c index 67c74e287a..3bb6807e5c 100644 --- a/src/lib-storage/mailbox-watch.c +++ b/src/lib-storage/mailbox-watch.c @@ -21,8 +21,7 @@ struct mailbox_notify_file { static void notify_delay_callback(struct mailbox *box) { - if (box->to_notify_delay != NULL) - timeout_remove(&box->to_notify_delay); + timeout_remove(&box->to_notify_delay); box->notify_callback(box, box->notify_context); } @@ -98,10 +97,8 @@ void mailbox_watch_remove_all(struct mailbox *box) i_free(file); } - if (box->to_notify_delay != NULL) - timeout_remove(&box->to_notify_delay); - if (box->to_notify != NULL) - timeout_remove(&box->to_notify); + timeout_remove(&box->to_notify_delay); + timeout_remove(&box->to_notify); } static void notify_extract_callback(struct mailbox *box ATTR_UNUSED) diff --git a/src/lib-test/test-ostream.c b/src/lib-test/test-ostream.c index a20a6c335d..674bba9c92 100644 --- a/src/lib-test/test-ostream.c +++ b/src/lib-test/test-ostream.c @@ -18,8 +18,7 @@ static void o_stream_test_destroy(struct iostream_private *stream) { struct test_ostream *tstream = (struct test_ostream *)stream; - if (tstream->to != NULL) - timeout_remove(&tstream->to); + timeout_remove(&tstream->to); if (tstream->internal_buf != NULL) buffer_free(&tstream->internal_buf); } diff --git a/src/lib/connection.c b/src/lib/connection.c index bce059cc7f..d5cfb8aebe 100644 --- a/src/lib/connection.c +++ b/src/lib/connection.c @@ -267,8 +267,7 @@ void connection_init_from_streams(struct connection_list *list, static void connection_socket_connected(struct connection *conn) { io_remove(&conn->io); - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); errno = net_geterror(conn->fd_in); connection_client_connected(conn, errno == 0); @@ -311,8 +310,7 @@ void connection_disconnect(struct connection *conn) { conn->last_input = 0; i_zero(&conn->last_input_tv); - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); io_remove(&conn->io); if (conn->input != NULL) { i_stream_close(conn->input); diff --git a/src/lib/istream-timeout.c b/src/lib/istream-timeout.c index 49229dcde2..2a45099c66 100644 --- a/src/lib/istream-timeout.c +++ b/src/lib/istream-timeout.c @@ -22,8 +22,7 @@ static void i_stream_timeout_close(struct iostream_private *stream, { struct timeout_istream *tstream = (struct timeout_istream *)stream; - if (tstream->to != NULL) - timeout_remove(&tstream->to); + timeout_remove(&tstream->to); if (close_parent) i_stream_close(tstream->istream.parent); } diff --git a/src/lib/log-throttle.c b/src/lib/log-throttle.c index a626ffb955..018a3113e9 100644 --- a/src/lib/log-throttle.c +++ b/src/lib/log-throttle.c @@ -40,8 +40,7 @@ void log_throttle_deinit(struct log_throttle **_throttle) struct log_throttle *throttle = *_throttle; *_throttle = NULL; - if (throttle->to_throttled != NULL) - timeout_remove(&throttle->to_throttled); + timeout_remove(&throttle->to_throttled); i_free(throttle); } diff --git a/src/lib/test-iostream-pump.c b/src/lib/test-iostream-pump.c index 65fdaf2937..374e0fb4c9 100644 --- a/src/lib/test-iostream-pump.c +++ b/src/lib/test-iostream-pump.c @@ -96,8 +96,7 @@ const char *run_pump(struct istream *in, struct ostream *out, int *counter, buff io_loop_run(current_ioloop); timeout_remove(&to); - if (to2 != NULL) - timeout_remove(&to2); + timeout_remove(&to2); alarm(0); test_assert(*counter == 0); diff --git a/src/lmtp/client.c b/src/lmtp/client.c index 23cfc00e3c..72540cea47 100644 --- a/src/lmtp/client.c +++ b/src/lmtp/client.c @@ -227,8 +227,7 @@ const char *client_remote_id(struct client *client) void client_io_reset(struct client *client) { io_remove(&client->io); - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); client->io = io_add(client->fd_in, IO_READ, client_input, client); client->last_input = ioloop_time; client->to_idle = timeout_add(CLIENT_IDLE_TIMEOUT_MSECS, @@ -295,8 +294,7 @@ void client_destroy(struct client *client, const char *prefix, if (client->proxy != NULL) lmtp_proxy_deinit(&client->proxy); io_remove(&client->io); - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); if (client->ssl_iostream != NULL) ssl_iostream_destroy(&client->ssl_iostream); i_stream_destroy(&client->input); diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index cd75210f0c..27869dc8be 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -1183,8 +1183,7 @@ static void client_input_data_write(struct client *client) struct istream *input; /* stop handling client input until saving/proxying is finished */ - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); io_remove(&client->io); i_stream_destroy(&client->dot_input); diff --git a/src/lmtp/lmtp-proxy.c b/src/lmtp/lmtp-proxy.c index 4c3c88b631..0db4287e41 100644 --- a/src/lmtp/lmtp-proxy.c +++ b/src/lmtp/lmtp-proxy.c @@ -106,8 +106,7 @@ void lmtp_proxy_deinit(struct lmtp_proxy **_proxy) i_stream_unref(&proxy->data_input); if (proxy->client_output != NULL) o_stream_unref(&proxy->client_output); - if (proxy->to_finish != NULL) - timeout_remove(&proxy->to_finish); + timeout_remove(&proxy->to_finish); array_free(&proxy->rcpt_to); array_free(&proxy->connections); pool_unref(&proxy->pool); @@ -218,8 +217,7 @@ static void lmtp_conn_finish(void *context) struct lmtp_proxy_connection *conn = context; conn->finished = TRUE; - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); if (conn->data_input != NULL) i_stream_unref(&conn->data_input); lmtp_proxy_try_finish(conn->proxy); diff --git a/src/login-common/access-lookup.c b/src/login-common/access-lookup.c index 7f5b509ba6..c9af9aa33c 100644 --- a/src/login-common/access-lookup.c +++ b/src/login-common/access-lookup.c @@ -108,8 +108,7 @@ void access_lookup_destroy(struct access_lookup **_lookup) *_lookup = NULL; - if (lookup->to != NULL) - timeout_remove(&lookup->to); + timeout_remove(&lookup->to); io_remove(&lookup->io); if (close(lookup->fd) < 0) i_error("close(%s) failed: %m", lookup->path); diff --git a/src/login-common/client-common-auth.c b/src/login-common/client-common-auth.c index 92709b46a7..4f69de395c 100644 --- a/src/login-common/client-common-auth.c +++ b/src/login-common/client-common-auth.c @@ -674,8 +674,7 @@ sasl_callback(struct client *client, enum sasl_server_reply sasl_reply, i_zero(&reply); switch (sasl_reply) { case SASL_SERVER_REPLY_SUCCESS: - if (client->to_auth_waiting != NULL) - timeout_remove(&client->to_auth_waiting); + timeout_remove(&client->to_auth_waiting); if (args != NULL) { client_auth_parse_args(client, TRUE, args, &reply); reply.all_fields = args; @@ -689,8 +688,7 @@ sasl_callback(struct client *client, enum sasl_server_reply sasl_reply, break; case SASL_SERVER_REPLY_AUTH_FAILED: case SASL_SERVER_REPLY_AUTH_ABORTED: - if (client->to_auth_waiting != NULL) - timeout_remove(&client->to_auth_waiting); + timeout_remove(&client->to_auth_waiting); if (args != NULL) { client_auth_parse_args(client, FALSE, args, &reply); client->last_auth_fail = reply.fail_code; @@ -738,8 +736,7 @@ sasl_callback(struct client *client, enum sasl_server_reply sasl_reply, i_assert(client->v.auth_send_challenge != NULL); client->v.auth_send_challenge(client, data); - if (client->to_auth_waiting != NULL) - timeout_remove(&client->to_auth_waiting); + timeout_remove(&client->to_auth_waiting); if (client->auth_response != NULL) str_truncate(client->auth_response, 0); @@ -821,8 +818,7 @@ void clients_notify_auth_connected(void) for (client = clients; client != NULL; client = next) { next = client->next; - if (client->to_auth_waiting != NULL) - timeout_remove(&client->to_auth_waiting); + timeout_remove(&client->to_auth_waiting); client_notify_auth_ready(client); diff --git a/src/login-common/client-common.c b/src/login-common/client-common.c index c9f394d0c3..a0a0f51076 100644 --- a/src/login-common/client-common.c +++ b/src/login-common/client-common.c @@ -264,10 +264,8 @@ void client_destroy(struct client *client, const char *reason) } io_remove(&client->io); - if (client->to_disconnect != NULL) - timeout_remove(&client->to_disconnect); - if (client->to_auth_waiting != NULL) - timeout_remove(&client->to_auth_waiting); + timeout_remove(&client->to_disconnect); + timeout_remove(&client->to_auth_waiting); if (client->auth_response != NULL) str_free(&client->auth_response); diff --git a/src/login-common/login-proxy-state.c b/src/login-common/login-proxy-state.c index f01c33d608..05509ed356 100644 --- a/src/login-common/login-proxy-state.c +++ b/src/login-common/login-proxy-state.c @@ -77,8 +77,7 @@ void login_proxy_state_deinit(struct login_proxy_state **_state) i_assert(rec->num_waiting_connections == 0); hash_table_iterate_deinit(&iter); - if (state->to_reopen != NULL) - timeout_remove(&state->to_reopen); + timeout_remove(&state->to_reopen); login_proxy_state_close(state); hash_table_destroy(&state->hash); pool_unref(&state->pool); diff --git a/src/login-common/login-proxy.c b/src/login-common/login-proxy.c index 49f80a8204..860b27fa46 100644 --- a/src/login-common/login-proxy.c +++ b/src/login-common/login-proxy.c @@ -465,10 +465,8 @@ int login_proxy_new(struct client *client, static void login_proxy_disconnect(struct login_proxy *proxy) { - if (proxy->to != NULL) - timeout_remove(&proxy->to); - if (proxy->to_notify != NULL) - timeout_remove(&proxy->to_notify); + timeout_remove(&proxy->to); + timeout_remove(&proxy->to_notify); if (!proxy->num_waiting_connections_updated) { i_assert(proxy->state_rec->num_waiting_connections > 0); @@ -705,8 +703,7 @@ void login_proxy_detach(struct login_proxy *proxy) i_assert(proxy->server_input != NULL); i_assert(proxy->server_output != NULL); - if (proxy->to != NULL) - timeout_remove(&proxy->to); + timeout_remove(&proxy->to); proxy->client_fd = i_stream_get_fd(client->input); proxy->client_input = client->input; diff --git a/src/login-common/main.c b/src/login-common/main.c index 573f4934dd..773c01ade7 100644 --- a/src/login-common/main.c +++ b/src/login-common/main.c @@ -146,8 +146,7 @@ client_connected_finish(const struct master_service_connection *conn) ssl_proxy_start(proxy); } - if (auth_client_to != NULL) - timeout_remove(&auth_client_to); + timeout_remove(&auth_client_to); } static void login_access_lookup_free(struct login_access_lookup *lookup) @@ -437,8 +436,7 @@ static void main_deinit(void) if (anvil != NULL) anvil_client_deinit(&anvil); - if (auth_client_to != NULL) - timeout_remove(&auth_client_to); + timeout_remove(&auth_client_to); client_common_deinit(); dsasl_clients_deinit(); login_settings_deinit(); diff --git a/src/master/main.c b/src/master/main.c index 1e29515727..cb19b68678 100644 --- a/src/master/main.c +++ b/src/master/main.c @@ -342,8 +342,7 @@ static void instance_update_now(struct master_instance_list *list) (void)master_instance_list_update(list, services->set->base_dir); } - if (to_instance != NULL) - timeout_remove(&to_instance); + timeout_remove(&to_instance); to_instance = timeout_add((3600 * 12 + i_rand_limit(60 * 30)) * 1000, instance_update_now, list); } diff --git a/src/master/service-monitor.c b/src/master/service-monitor.c index 67be42c466..c13d6bf84a 100644 --- a/src/master/service-monitor.c +++ b/src/master/service-monitor.c @@ -68,8 +68,7 @@ static void service_status_more(struct service_process *process, process->available_count - status->available_count; process->idle_start = 0; - if (process->to_idle != NULL) - timeout_remove(&process->to_idle); + timeout_remove(&process->to_idle); if (status->available_count != 0) return; @@ -146,10 +145,8 @@ service_status_input_one(struct service *service, } process->last_status_update = ioloop_time; - if (process->to_status != NULL) { - /* first status notification */ - timeout_remove(&process->to_status); - } + /* first status notification */ + timeout_remove(&process->to_status); if (process->available_count == status->available_count) return; @@ -375,8 +372,7 @@ static void service_monitor_listen_start_force(struct service *service) service->listening = TRUE; service->listen_pending = FALSE; - if (service->to_drop != NULL) - timeout_remove(&service->to_drop); + timeout_remove(&service->to_drop); array_foreach(&service->listeners, listeners) { struct service_listener *l = *listeners; @@ -407,8 +403,7 @@ void service_monitor_listen_stop(struct service *service) } service->listening = FALSE; service->listen_pending = FALSE; - if (service->to_drop != NULL) - timeout_remove(&service->to_drop); + timeout_remove(&service->to_drop); } static int service_login_create_notify_fd(struct service *service) @@ -545,14 +540,11 @@ void service_monitor_stop(struct service *service) } service->login_notify_fd = -1; } - if (service->to_login_notify != NULL) - timeout_remove(&service->to_login_notify); + timeout_remove(&service->to_login_notify); service_monitor_listen_stop(service); - if (service->to_throttle != NULL) - timeout_remove(&service->to_throttle); - if (service->to_prefork != NULL) - timeout_remove(&service->to_prefork); + timeout_remove(&service->to_throttle); + timeout_remove(&service->to_prefork); } void service_monitor_stop_close(struct service *service) diff --git a/src/master/service-process.c b/src/master/service-process.c index fdbde99967..c869da1a64 100644 --- a/src/master/service-process.c +++ b/src/master/service-process.c @@ -374,10 +374,8 @@ void service_process_destroy(struct service_process *process) service->process_count--; i_assert(service->process_avail <= service->process_count); - if (process->to_status != NULL) - timeout_remove(&process->to_status); - if (process->to_idle != NULL) - timeout_remove(&process->to_idle); + timeout_remove(&process->to_status); + timeout_remove(&process->to_idle); if (service->list->log_byes != NULL) service_process_notify_add(service->list->log_byes, process); diff --git a/src/master/service.c b/src/master/service.c index c853f4334f..f57044886c 100644 --- a/src/master/service.c +++ b/src/master/service.c @@ -535,8 +535,7 @@ static void service_login_notify_send(struct service *service) unsigned int uninitialized_count; service->last_login_notify_time = ioloop_time; - if (service->to_login_notify != NULL) - timeout_remove(&service->to_login_notify); + timeout_remove(&service->to_login_notify); service_signal(service, SIGUSR1, &uninitialized_count); } @@ -660,8 +659,7 @@ void service_list_unref(struct service_list *service_list) if (--service_list->refcount > 0) return; - if (service_list->to_kill != NULL) - timeout_remove(&service_list->to_kill); + timeout_remove(&service_list->to_kill); pool_unref(&service_list->set_pool); pool_unref(&service_list->pool); } diff --git a/src/plugins/last-login/last-login-plugin.c b/src/plugins/last-login/last-login-plugin.c index cbdb0cc82a..d281b3507f 100644 --- a/src/plugins/last-login/last-login-plugin.c +++ b/src/plugins/last-login/last-login-plugin.c @@ -35,8 +35,7 @@ static void last_login_dict_deinit(struct mail_user *user) } /* remove timeout after dict_wait(), which may trigger last_login_dict_commit() */ - if (luser->to != NULL) - timeout_remove(&luser->to); + timeout_remove(&luser->to); } static void last_login_user_deinit(struct mail_user *user) diff --git a/src/plugins/mail-crypt/mail-crypt-plugin.c b/src/plugins/mail-crypt/mail-crypt-plugin.c index 45017cf4f9..21c1095378 100644 --- a/src/plugins/mail-crypt/mail-crypt-plugin.c +++ b/src/plugins/mail-crypt/mail-crypt-plugin.c @@ -73,8 +73,7 @@ static void mail_crypt_cache_close(struct mail_crypt_user *muser) { struct mail_crypt_cache *cache = &muser->cache; - if (cache->to != NULL) - timeout_remove(&cache->to); + timeout_remove(&cache->to); if (cache->input != NULL) i_stream_unref(&cache->input); i_zero(cache); diff --git a/src/plugins/quota-clone/quota-clone-plugin.c b/src/plugins/quota-clone/quota-clone-plugin.c index d9686896ec..eefb2f8cc9 100644 --- a/src/plugins/quota-clone/quota-clone-plugin.c +++ b/src/plugins/quota-clone/quota-clone-plugin.c @@ -103,8 +103,7 @@ static void quota_clone_flush(struct mailbox *box) struct quota_clone_user *quser = QUOTA_CLONE_USER_CONTEXT(box->storage->user); - if (qbox->to_quota_flush != NULL) - timeout_remove(&qbox->to_quota_flush); + timeout_remove(&qbox->to_quota_flush); if (quser->quota_flushing) { /* recursing back from quota recalculation */ diff --git a/src/plugins/stats/stats-plugin.c b/src/plugins/stats/stats-plugin.c index d843c5915a..a406980c83 100644 --- a/src/plugins/stats/stats-plugin.c +++ b/src/plugins/stats/stats-plugin.c @@ -138,8 +138,7 @@ static void session_stats_refresh(struct mail_user *user) suser->session_stats); } - if (suser->to_stats_timeout != NULL) - timeout_remove(&suser->to_stats_timeout); + timeout_remove(&suser->to_stats_timeout); suser->to_stats_timeout = timeout_add(to_next_secs*1000, session_stats_refresh_timeout, user); @@ -341,8 +340,7 @@ static void stats_user_deinit(struct mail_user *user) if (suser->stats_connected) mail_stats_connection_disconnect(stats_conn, user); - if (suser->to_stats_timeout != NULL) - timeout_remove(&suser->to_stats_timeout); + timeout_remove(&suser->to_stats_timeout); suser->module_ctx.super.deinit(user); stats_connection_unref(&stats_conn); diff --git a/src/plugins/zlib/zlib-plugin.c b/src/plugins/zlib/zlib-plugin.c index 2435678651..4600e2b8a2 100644 --- a/src/plugins/zlib/zlib-plugin.c +++ b/src/plugins/zlib/zlib-plugin.c @@ -68,8 +68,7 @@ static void zlib_mail_cache_close(struct zlib_user *zuser) { struct zlib_mail_cache *cache = &zuser->cache; - if (cache->to != NULL) - timeout_remove(&cache->to); + timeout_remove(&cache->to); if (cache->input != NULL) i_stream_unref(&cache->input); i_zero(cache); diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index 548acfd256..bbfe8cb7df 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -603,8 +603,7 @@ static void client_default_destroy(struct client *client, const char *reason) if (client->session_dotlock != NULL) file_dotlock_delete(&client->session_dotlock); - if (client->to_session_dotlock_refresh != NULL) - timeout_remove(&client->to_session_dotlock_refresh); + timeout_remove(&client->to_session_dotlock_refresh); if (client->uidl_pool != NULL) pool_unref(&client->uidl_pool); @@ -615,8 +614,7 @@ static void client_default_destroy(struct client *client, const char *reason) io_remove(&client->io); timeout_remove(&client->to_idle); - if (client->to_commit != NULL) - timeout_remove(&client->to_commit); + timeout_remove(&client->to_commit); i_stream_destroy(&client->input); o_stream_destroy(&client->output); @@ -659,8 +657,7 @@ void client_disconnect(struct client *client, const char *reason) i_stream_close(client->input); o_stream_close(client->output); - if (client->to_idle != NULL) - timeout_remove(&client->to_idle); + timeout_remove(&client->to_idle); client->to_idle = timeout_add(0, client_destroy_timeout, client); } diff --git a/src/replication/aggregator/replicator-connection.c b/src/replication/aggregator/replicator-connection.c index 00f662e9a5..270c04a2a3 100644 --- a/src/replication/aggregator/replicator-connection.c +++ b/src/replication/aggregator/replicator-connection.c @@ -167,8 +167,7 @@ static void replicator_connection_connect(struct replicator_connection *conn) return; } - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); conn->fd = fd; conn->io = io_add(fd, IO_READ, replicator_input, conn); conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE); @@ -255,8 +254,7 @@ void replicator_connection_destroy(struct replicator_connection **_conn) for (i = REPLICATION_PRIORITY_LOW; i <= REPLICATION_PRIORITY_SYNC; i++) buffer_free(&conn->queue[i]); - if (conn->to != NULL) - timeout_remove(&conn->to); + timeout_remove(&conn->to); hash_table_destroy(&conn->requests); i_free(conn); } diff --git a/src/replication/replicator/dsync-client.c b/src/replication/replicator/dsync-client.c index cc3fd86818..ecf6da8a13 100644 --- a/src/replication/replicator/dsync-client.c +++ b/src/replication/replicator/dsync-client.c @@ -52,8 +52,7 @@ static void dsync_callback(struct dsync_client *client, dsync_callback_t *callback = client->callback; void *context = client->context; - if (client->to != NULL) - timeout_remove(&client->to); + timeout_remove(&client->to); client->callback = NULL; client->context = NULL; diff --git a/src/replication/replicator/replicator-brain.c b/src/replication/replicator/replicator-brain.c index 0769cf6318..6f9721046e 100644 --- a/src/replication/replicator/replicator-brain.c +++ b/src/replication/replicator/replicator-brain.c @@ -62,8 +62,7 @@ void replicator_brain_deinit(struct replicator_brain **_brain) brain->deinitializing = TRUE; array_foreach_modifiable(&brain->dsync_clients, connp) dsync_client_deinit(connp); - if (brain->to != NULL) - timeout_remove(&brain->to); + timeout_remove(&brain->to); pool_unref(&brain->pool); } @@ -173,8 +172,7 @@ static bool replicator_brain_fill_next(struct replicator_brain *brain) user = replicator_queue_pop(brain->queue, &next_secs); if (user == NULL) { /* nothing more to do */ - if (brain->to != NULL) - timeout_remove(&brain->to); + timeout_remove(&brain->to); brain->to = timeout_add(next_secs * 1000, replicator_brain_timeout, brain); return FALSE; diff --git a/src/stats/client.c b/src/stats/client.c index 876c53062a..ae066648e3 100644 --- a/src/stats/client.c +++ b/src/stats/client.c @@ -74,8 +74,7 @@ static void client_input(struct client *client) const char *const *args, *error; int ret; - if (client->to_pending != NULL) - timeout_remove(&client->to_pending); + timeout_remove(&client->to_pending); switch (i_stream_read(client->input)) { case -2: diff --git a/src/stats/mail-session.c b/src/stats/mail-session.c index 84a5baaf3a..3b1a7d8141 100644 --- a/src/stats/mail-session.c +++ b/src/stats/mail-session.c @@ -157,8 +157,7 @@ static void mail_session_free(struct mail_session *session) global_memory_free(mail_session_memsize(session)); - if (session->to_idle != NULL) - timeout_remove(&session->to_idle); + timeout_remove(&session->to_idle); if (!session->disconnected) hash_table_remove(mail_sessions_hash, session->id); DLLIST_REMOVE_FULL(&stable_mail_sessions, session, diff --git a/src/stats/stats-carbon.c b/src/stats/stats-carbon.c index dad728fbfc..8e580e55cd 100644 --- a/src/stats/stats-carbon.c +++ b/src/stats/stats-carbon.c @@ -34,8 +34,7 @@ stats_carbon_destroy(struct stats_send_ctx **_ctx) *_ctx = NULL; io_remove(&ctx->io); - if (ctx->to != NULL) - timeout_remove(&ctx->to); + timeout_remove(&ctx->to); i_close_fd(&ctx->fd); pool_unref(&ctx->pool); } diff --git a/src/util/rawlog.c b/src/util/rawlog.c index 6c0c36da40..f0f4ef7f54 100644 --- a/src/util/rawlog.c +++ b/src/util/rawlog.c @@ -63,8 +63,7 @@ static void rawlog_proxy_destroy(struct rawlog_proxy *proxy) } io_remove(&proxy->client_io); io_remove(&proxy->server_io); - if (proxy->to_flush != NULL) - timeout_remove(&proxy->to_flush); + timeout_remove(&proxy->to_flush); o_stream_destroy(&proxy->client_output); o_stream_destroy(&proxy->server_output);