Skip to content

Commit

Permalink
global: start relying on http_client_request_abort(NULL) being a no-op
Browse files Browse the repository at this point in the history
Cleanup performed with the following semantic patch:

	@@
	expression E;
	@@

	- if (E != NULL) {
	- 	http_client_request_abort(&E);
	- }
	+ http_client_request_abort(&E);
  • Loading branch information
Josef 'Jeff' Sipek authored and sirainen committed Jun 13, 2018
1 parent 30f854e commit de3f705
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/auth/auth-policy.c
Expand Up @@ -236,8 +236,7 @@ void auth_policy_finish(struct policy_lookup_ctx *context)
const char *error ATTR_UNUSED;
(void)json_parser_deinit(&context->parser, &error);
}
if (context->http_request != NULL)
http_client_request_abort(&context->http_request);
http_client_request_abort(&context->http_request);
if (context->request != NULL)
auth_request_unref(&context->request);
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib-http/http-client-connection.c
Expand Up @@ -1726,8 +1726,7 @@ http_client_connection_disconnect(struct http_client_connection *conn)
conn->closing = TRUE;
conn->connected = FALSE;

if (conn->connect_request != NULL)
http_client_request_abort(&conn->connect_request);
http_client_request_abort(&conn->connect_request);

if (conn->incoming_payload != NULL) {
/* the stream is still accessed by lib-http caller. */
Expand Down
3 changes: 1 addition & 2 deletions src/lib-oauth2/oauth2.c
Expand Up @@ -71,8 +71,7 @@ oauth2_request_abort(struct oauth2_request **_req)
struct oauth2_request *req = *_req;
*_req = NULL;

if (req->req != NULL)
http_client_request_abort(&req->req);
http_client_request_abort(&req->req);
oauth2_request_free_internal(req);
}

Expand Down
3 changes: 1 addition & 2 deletions src/plugins/fts-solr/solr-connection.c
Expand Up @@ -556,8 +556,7 @@ int solr_connection_post_end(struct solr_connection_post **_post)
ret = -1;
}
} else {
if (post->http_req != NULL)
http_client_request_abort(&post->http_req);
http_client_request_abort(&post->http_req);
}
i_free(post);

Expand Down
3 changes: 1 addition & 2 deletions src/plugins/fts/fts-parser-tika.c
Expand Up @@ -250,8 +250,7 @@ static int fts_parser_tika_deinit(struct fts_parser *_parser, const char **retri
timeout to ioloop unnecessarily */
i_stream_unref(&parser->payload);
io_remove(&parser->io);
if (parser->http_req != NULL)
http_client_request_abort(&parser->http_req);
http_client_request_abort(&parser->http_req);
if (parser->ioloop != NULL) {
io_loop_set_current(parser->ioloop);
io_loop_destroy(&parser->ioloop);
Expand Down

0 comments on commit de3f705

Please sign in to comment.