Skip to content

Commit

Permalink
global: Start relying on event_set_forced_debug(e, FALSE) being a no-op
Browse files Browse the repository at this point in the history
Converted using the following semantic patch:

	@@
	expression event;
	expression cond;
	@@

	- if (cond) {
	- 	event_set_forced_debug(event,
	(
	- TRUE
	|
	- cond
	)
	- );
	- }
	+ event_set_forced_debug(event, cond);
  • Loading branch information
Josef 'Jeff' Sipek authored and cmouse committed Aug 7, 2018
1 parent c5dc248 commit 47418f3
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/auth/auth-client-connection.c
Expand Up @@ -336,8 +336,7 @@ void auth_client_connection_create(struct auth *auth, int fd,
conn->login_requests = login_requests;
conn->token_auth = token_auth;
conn->event = event_create(NULL);
if (auth->set->debug)
event_set_forced_debug(conn->event, TRUE);
event_set_forced_debug(conn->event, auth->set->debug);
event_add_category(conn->event, &event_category_auth);
random_fill(conn->cookie, sizeof(conn->cookie));

Expand Down
3 changes: 1 addition & 2 deletions src/auth/auth-request.c
Expand Up @@ -87,8 +87,7 @@ static void auth_request_post_alloc_init(struct auth_request *request, struct ev
request->debug = request->set->debug;
request->extra_fields = auth_fields_init(request->pool);
request->event = event_create(parent_event);
if (request->set->debug)
event_set_forced_debug(request->event, TRUE);
event_set_forced_debug(request->event, request->set->debug);
event_add_category(request->event, &event_category_auth);
}

Expand Down
3 changes: 1 addition & 2 deletions src/auth/auth.c
Expand Up @@ -377,8 +377,7 @@ void auths_preinit(const struct auth_settings *set, pool_t pool,
bool check_default = TRUE;

auth_event = event_create(NULL);
if (set->debug)
event_set_forced_debug(auth_event, TRUE);
event_set_forced_debug(auth_event, set->debug);
event_add_category(auth_event, &event_category_auth);
i_array_init(&auths, 8);

Expand Down
3 changes: 1 addition & 2 deletions src/imap-urlauth/imap-urlauth-client.c
Expand Up @@ -67,8 +67,7 @@ int client_create(const char *service, const char *username,
client->set = set;

client->event = event_create(NULL);
if (set->mail_debug)
event_set_forced_debug(client->event, TRUE);
event_set_forced_debug(client->event, set->mail_debug);
event_add_category(client->event, &event_category_urlauth);

if (client_worker_connect(client) < 0) {
Expand Down
3 changes: 1 addition & 2 deletions src/lib-http/http-client-request.c
Expand Up @@ -235,8 +235,7 @@ void http_client_request_set_event(struct http_client_request *req,
{
event_unref(&req->event);
req->event = event_create(event);
if (req->client->set.debug)
event_set_forced_debug(req->event, TRUE);
event_set_forced_debug(req->event, req->client->set.debug);
http_client_request_update_event(req);
}

Expand Down
7 changes: 3 additions & 4 deletions src/lib-http/http-client.c
Expand Up @@ -135,8 +135,8 @@ http_client_init_shared(struct http_client_context *cctx,
parent_event = event_get_parent(cctx->event);
}
client->event = event_create(parent_event);
if ((set != NULL && set->debug) || (cctx != NULL && cctx->set.debug))
event_set_forced_debug(client->event, TRUE);
event_set_forced_debug(client->event,
(set != NULL && set->debug) || (cctx != NULL && cctx->set.debug));
event_set_append_log_prefix(client->event, log_prefix);

/* merge provided settings with context defaults */
Expand Down Expand Up @@ -437,8 +437,7 @@ http_client_context_create(const struct http_client_settings *set)
cctx->ioloop = current_ioloop;

cctx->event = event_create(set->event);
if (set->debug)
event_set_forced_debug(cctx->event, TRUE);
event_set_forced_debug(cctx->event, set->debug);
event_set_append_log_prefix(cctx->event, "http-client: ");

cctx->set.dns_client = set->dns_client;
Expand Down
5 changes: 2 additions & 3 deletions src/lib-storage/mail-storage-service.c
Expand Up @@ -1322,9 +1322,8 @@ mail_storage_service_lookup_real(struct mail_storage_service_ctx *ctx,
This event won't be a parent to any other events - mail_user.event
will be used for that. */
user->event = event_create(input->parent_event);
if (user->service_ctx->debug ||
(flags & MAIL_STORAGE_SERVICE_FLAG_DEBUG) != 0)
event_set_forced_debug(user->event, TRUE);
event_set_forced_debug(user->event,
user->service_ctx->debug || (flags & MAIL_STORAGE_SERVICE_FLAG_DEBUG) != 0);
event_add_fields(user->event, (const struct event_add_field []){
{ .key = "user", .value = user->input.username },
{ .key = "service", .value = ctx->service->name },
Expand Down
3 changes: 1 addition & 2 deletions src/login-common/main.c
Expand Up @@ -457,8 +457,7 @@ static void main_init(const char *login_socket)
restrict_process_count(1);

event_auth = event_create(NULL);
if (global_login_settings->auth_debug)
event_set_forced_debug(event_auth, TRUE);
event_set_forced_debug(event_auth, global_login_settings->auth_debug);
event_add_category(event_auth, &event_category_auth);

i_array_init(&global_alt_usernames, 4);
Expand Down

0 comments on commit 47418f3

Please sign in to comment.