]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: timeout_remove(NULL) is a no-op
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Mon, 27 Nov 2017 19:11:40 +0000 (14:11 -0500)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 13 Dec 2017 10:32:08 +0000 (12:32 +0200)
12 files changed:
src/dict/dict-connection.c
src/director/user-directory.c
src/imap/imap-notify.c
src/lib-http/http-client-host.c
src/lib-http/http-client-peer.c
src/lib-http/http-client-queue.c
src/lib-imap-client/imapc-connection.c
src/lib-ldap/ldap-connection.c
src/lib-master/anvil-client.c
src/lib-master/master-service.c
src/lib-sql/driver-pgsql.c
src/plugins/fts-lucene/lucene-wrapper.cc

index 934ea2d54d960639fbded8aafc0dc7262cfbd492..66dc9bcaf272f291e8c9aa776cd775c02b495571 100644 (file)
@@ -113,8 +113,7 @@ static void dict_connection_input_more(struct dict_connection *conn)
        const char *line;
        int ret;
 
-       if (conn->to_input != NULL)
-               timeout_remove(&conn->to_input);
+       timeout_remove(&conn->to_input);
 
        while ((line = i_stream_next_line(conn->input)) != NULL) {
                T_BEGIN {
@@ -126,8 +125,7 @@ static void dict_connection_input_more(struct dict_connection *conn)
                }
                if (array_count(&conn->cmds) >= DICT_CONN_MAX_PENDING_COMMANDS) {
                        io_remove(&conn->io);
-                       if (conn->to_input != NULL)
-                               timeout_remove(&conn->to_input);
+                       timeout_remove(&conn->to_input);
                        break;
                }
        }
index f0fca7f35b22c87748fd2aca0a35c47e84a7a1e8..b4acab315763811f46fe26272fb95f82981f0148 100644 (file)
@@ -110,8 +110,7 @@ static void user_directory_drop_expired(struct user_directory *dir)
        i_assert(expire_timestamp > ioloop_time || expire_timestamp == 0);
 
        if (expire_timestamp != dir->to_expire_timestamp) {
-               if (dir->to_expire != NULL)
-                       timeout_remove(&dir->to_expire);
+               timeout_remove(&dir->to_expire);
                if (expire_timestamp != 0) {
                        struct timeval tv = { .tv_sec = expire_timestamp };
                        dir->to_expire_timestamp = tv.tv_sec;
@@ -287,8 +286,7 @@ void user_directory_deinit(struct user_directory **_dir)
 
        while (dir->head != NULL)
                user_free(dir, dir->head);
-       if (dir->to_expire != NULL)
-               timeout_remove(&dir->to_expire);
+       timeout_remove(&dir->to_expire);
        hash_table_destroy(&dir->hash);
        array_free(&dir->iters);
        i_free(dir);
index 306cc5bef0420a944d50ce4b8e8223859d0dcdb3..7b964eec935a47813bdb6a1f5e104ab3a0abc787 100644 (file)
@@ -459,8 +459,7 @@ void imap_client_notify_command_allocated(struct client *client)
                mailbox_notify_changes_stop(client->mailbox);
                ctx->watching_mailbox = FALSE;
        }
-       if (ctx->to_watch != NULL)
-               timeout_remove(&ctx->to_watch);
+       timeout_remove(&ctx->to_watch);
 }
 
 int imap_notify_begin(struct imap_notify_context *ctx)
index fed2d810700a47a64da0fdbd891e831729c83c7b..77ba8ec3ee32eee69b28459b0c1ad0db100a0331 100644 (file)
@@ -309,8 +309,7 @@ void http_client_host_shared_free(struct http_client_host_shared **_hshared)
 
        http_client_host_shared_debug(hshared, "Host destroy");
 
-       if (hshared->to_idle != NULL)
-               timeout_remove(&hshared->to_idle);
+       timeout_remove(&hshared->to_idle);
 
        DLLIST_REMOVE(&cctx->hosts_list, hshared);
        if (hshared == cctx->unix_host)
index 3c5cf63a4d55f3ea2d6d8122ab0b1a1894fa2425..1079f2eadcb0c729779ebb2cf5f32a7e2fcfa3e3 100644 (file)
@@ -376,8 +376,7 @@ void http_client_peer_shared_unref(struct http_client_peer_shared **_pshared)
                (const struct http_client_peer_addr *)&pshared->addr);
        DLLIST_REMOVE(&pshared->cctx->peers_list, pshared);
 
-       if (pshared->to_backoff != NULL)
-               timeout_remove(&pshared->to_backoff);
+       timeout_remove(&pshared->to_backoff);
 
        i_free(pshared->addr_name);
        i_free(pshared->label);
@@ -657,8 +656,7 @@ http_client_peer_disconnect(struct http_client_peer *peer)
                http_client_connection_lost_peer(*conn);
        i_assert(array_count(&peer->conns) == 0);
 
-       if (peer->to_req_handling != NULL)
-               timeout_remove(&peer->to_req_handling);
+       timeout_remove(&peer->to_req_handling);
 
        /* unlist in client */
        DLLIST_REMOVE_FULL
@@ -1152,8 +1150,7 @@ http_client_peer_handle_requests_real(struct http_client_peer *peer)
 
 static void http_client_peer_handle_requests(struct http_client_peer *peer)
 {
-       if (peer->to_req_handling != NULL)
-               timeout_remove(&peer->to_req_handling);
+       timeout_remove(&peer->to_req_handling);
        
        T_BEGIN {
                http_client_peer_handle_requests_real(peer);
index 83135ab170e64ecd582229916ee210da8b7e288e..023a8ee8a281ed8d4a38b64bd1e6a0aa51a5dafd 100644 (file)
@@ -167,10 +167,8 @@ void http_client_queue_free(struct http_client_queue *queue)
        array_free(&queue->delayed_requests);
 
        /* cancel timeouts */
-       if (queue->to_connect != NULL)
-               timeout_remove(&queue->to_connect);
-       if (queue->to_delayed != NULL)
-               timeout_remove(&queue->to_delayed);
+       timeout_remove(&queue->to_connect);
+       timeout_remove(&queue->to_delayed);
 
        /* free */
        i_free(queue->addr_name);
@@ -720,8 +718,7 @@ http_client_queue_request_timeout(struct http_client_queue *queue)
                t_strflocaltime("%Y-%m-%d %H:%M:%S", ioloop_timeval.tv_sec),
                        ((unsigned long)ioloop_timeval.tv_usec)/1000);
 
-       if (queue->to_request != NULL)
-               timeout_remove(&queue->to_request);
+       timeout_remove(&queue->to_request);
 
        /* collect failed requests */
        reqs = array_get(&queue->requests, &count);
index 9855c4b140bb1ec1b3d6b35f47d93de190452f7b..22b1a06e82aaac814341205548abbc24c4ec576a 100644 (file)
@@ -345,8 +345,7 @@ void imapc_connection_abort_commands(struct imapc_connection *conn,
                cmd->callback(&reply, cmd->context);
                imapc_command_free(cmd);
        }
-       if (conn->to != NULL)
-               timeout_remove(&conn->to);
+       timeout_remove(&conn->to);
 }
 
 static void
index 288fc3cb5141ef6d8354150d9da23fa21b22e847..1019072f909b0df120124f73f3a3bd2db514e745 100644 (file)
@@ -240,8 +240,7 @@ void ldap_connection_send_next(struct ldap_connection *conn)
        unsigned int i = 0, n;
        struct ldap_op_queue_entry *req;
 
-       if (conn->to_reconnect != NULL)
-               timeout_remove(&(conn->to_reconnect));
+       timeout_remove(&(conn->to_reconnect));
 
        if (conn->state == LDAP_STATE_DISCONNECT) {
                if (ldap_connection_connect(conn) == -1)
@@ -551,10 +550,8 @@ void ldap_connection_kill(struct ldap_connection *conn)
 {
        if (conn->io != NULL)
                io_remove_closed(&(conn->io));
-       if (conn->to_disconnect != NULL)
-               timeout_remove(&(conn->to_disconnect));
-       if (conn->to_reconnect != NULL)
-               timeout_remove(&(conn->to_reconnect));
+       timeout_remove(&(conn->to_disconnect));
+       timeout_remove(&(conn->to_reconnect));
        if (conn->request_queue != NULL) {
                unsigned int n = aqueue_count(conn->request_queue);
 
index 2874a8b91042f587025df09c0a60a18901a1c41a..4cf00e652f2b2d9358489caacad957246808dd17 100644 (file)
@@ -234,8 +234,7 @@ anvil_client_query(struct anvil_client *client, const char *query,
                /* connection failure. add a delayed failure callback.
                   the caller may not expect the callback to be called
                   immediately. */
-               if (client->to_query != NULL)
-                       timeout_remove(&client->to_query);
+               timeout_remove(&client->to_query);
                client->to_query =
                        timeout_add_short(0, anvil_client_cancel_queries, client);
        } else if (client->to_query == NULL) {
index 4f8348710852f2100e97c5c3eb2ffc68219f2e21..f45610e556aabb6ff388193c71de549741b27066 100644 (file)
@@ -1181,8 +1181,7 @@ void master_status_update(struct master_service *service)
            service->master_status.available_count ==
            service->last_sent_status_avail_count) {
                /* a) closed, b) updating to same state */
-               if (service->to_status != NULL)
-                       timeout_remove(&service->to_status);
+               timeout_remove(&service->to_status);
                if (service->io_status_write != NULL)
                        io_remove(&service->io_status_write);
                return;
index f1985f094ab114f90fc7f74f3abc00036f430eef..a5e57652e2aa136b9de06b30d8c593b2345f7831 100644 (file)
@@ -584,12 +584,9 @@ static void driver_pgsql_sync_init(struct pgsql_db *db)
 
        /* have to move our existing I/O and timeout handlers to new I/O loop */
        io_remove(&db->io);
-       if (db->to_connect != NULL) {
-               timeout_remove(&db->to_connect);
-               add_to_connect = TRUE;
-       } else {
-               add_to_connect = FALSE;
-       }
+
+       add_to_connect = (db->to_connect != NULL);
+       timeout_remove(&db->to_connect);
 
        db->ioloop = io_loop_create();
        if (add_to_connect) {
index 68d25c78c7c1999d9955ad28e1633b5020c0bd1a..13ee3275faa6b457b1713a07f11c3309575bac65 100644 (file)
@@ -152,8 +152,7 @@ struct lucene_index *lucene_index_init(const char *path,
 
 void lucene_index_close(struct lucene_index *index)
 {
-       if (index->to_close != NULL)
-               timeout_remove(&index->to_close);
+       timeout_remove(&index->to_close);
 
        _CLDELETE(index->searcher);
        if (index->writer != NULL) {