From 6488fd4ead5d35c3d7f794d8b1dbf5a8102c10ec Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan.bosch@dovecot.fi>
Date: Wed, 15 May 2019 13:10:55 +0200
Subject: [PATCH] lib-sieve: sieve-error - Merge nested if-statements in
 sieve_direct_logv().

---
 src/lib-sieve/sieve-error.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/lib-sieve/sieve-error.c b/src/lib-sieve/sieve-error.c
index cf20b9561..2017230c6 100644
--- a/src/lib-sieve/sieve-error.c
+++ b/src/lib-sieve/sieve-error.c
@@ -99,26 +99,25 @@ void sieve_direct_logv(struct sieve_instance *svinst,
 		       const char *fmt, va_list args)
 {
 	if ((flags & SIEVE_ERROR_FLAG_GLOBAL) != 0 &&
-	    (ehandler == NULL || ehandler->parent == NULL)) {
-		if (!ehandler->master_log ||
-		    (flags & SIEVE_ERROR_FLAG_GLOBAL_MAX_INFO) != 0) {
-			struct sieve_error_params new_params = *params;
-			va_list args_copy;
+	    (ehandler == NULL || ehandler->parent == NULL) &&
+	    (!ehandler->master_log ||
+	     (flags & SIEVE_ERROR_FLAG_GLOBAL_MAX_INFO) != 0)) {
+		struct sieve_error_params new_params = *params;
+		va_list args_copy;
 
-			VA_COPY(args_copy, args);
+		VA_COPY(args_copy, args);
 
-			if ((flags & SIEVE_ERROR_FLAG_GLOBAL_MAX_INFO) != 0 &&
-			    new_params.log_type > LOG_TYPE_INFO)
-				new_params.log_type = LOG_TYPE_INFO;
+		if ((flags & SIEVE_ERROR_FLAG_GLOBAL_MAX_INFO) != 0 &&
+		    new_params.log_type > LOG_TYPE_INFO)
+			new_params.log_type = LOG_TYPE_INFO;
 
-			sieve_direct_master_vlog(svinst, &new_params,
-						 fmt, args_copy);
+		sieve_direct_master_vlog(svinst, &new_params,
+					 fmt, args_copy);
 
-			va_end(args_copy);
+		va_end(args_copy);
 
-			if (ehandler->master_log)
-				return;
-		}
+		if (ehandler->master_log)
+			return;
 	}
 
 	if (ehandler == NULL)
-- 
GitLab