From 61a9770a5b00718563966c9246e144c8a73e8424 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan.bosch@dovecot.fi>
Date: Tue, 9 Apr 2019 19:47:57 +0200
Subject: [PATCH] lib-sieve: Replace sieve_script_sys_debug() with e_debug().

---
 src/lib-sieve/sieve-script.c                   | 15 +++++++--------
 src/lib-sieve/storage/dict/sieve-dict-script.c |  4 ++--
 src/lib-sieve/storage/file/sieve-file-script.c |  5 ++---
 src/lib-sieve/storage/ldap/sieve-ldap-script.c | 12 +++++-------
 4 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/src/lib-sieve/sieve-script.c b/src/lib-sieve/sieve-script.c
index a3d73f5fc..7718feb71 100644
--- a/src/lib-sieve/sieve-script.c
+++ b/src/lib-sieve/sieve-script.c
@@ -177,12 +177,10 @@ int sieve_script_open(struct sieve_script *script, enum sieve_error *error_r)
 	script->open = TRUE;
 
 	if (*script->name != '\0') {
-		sieve_script_sys_debug(script,
-			"Opened script `%s' from `%s'",
+		e_debug(script->event, "Opened script `%s' from `%s'",
 			script->name, script->location);
 	} else {
-		sieve_script_sys_debug(script,
-			"Opened nameless script from `%s'",
+		e_debug(script->event, "Opened nameless script from `%s'",
 			script->location);
 	}
 	return 0;
@@ -377,7 +375,7 @@ int sieve_script_binary_read_metadata(struct sieve_script *script,
 		return -1;
 	}
 	if (strcmp(str_c(storage_class), script->driver_name) != 0) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports unexpected driver name for script `%s' "
 			"(`%s' rather than `%s')",
 			sieve_binary_path(sbin), script->location,
@@ -394,7 +392,7 @@ int sieve_script_binary_read_metadata(struct sieve_script *script,
 		return -1;
 	}
 	if (script->storage->version != version) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' was compiled with "
 			"a different version of the `%s' script storage class "
 			"(compiled v%d, expected v%d; "
@@ -414,10 +412,11 @@ int sieve_script_binary_read_metadata(struct sieve_script *script,
 	}
 	i_assert(script->location != NULL);
 	if (strcmp(str_c(location), script->location) != 0) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports different location "
 			"for script `%s' (binary points to `%s')",
-			sieve_binary_path(sbin), script->location, str_c(location));
+			sieve_binary_path(sbin), script->location,
+			str_c(location));
 		return 0;
 	}
 
diff --git a/src/lib-sieve/storage/dict/sieve-dict-script.c b/src/lib-sieve/storage/dict/sieve-dict-script.c
index dc49dd5ef..67850f049 100644
--- a/src/lib-sieve/storage/dict/sieve-dict-script.c
+++ b/src/lib-sieve/storage/dict/sieve-dict-script.c
@@ -89,7 +89,7 @@ static int sieve_dict_script_open
 				"Failed to lookup script id from path %s: %s", path, error);
 			*error_r = SIEVE_ERROR_TEMP_FAILURE;
 		} else {
-			sieve_script_sys_debug(script,
+			e_debug(script->event,
 				"Script `%s' not found at path %s", name, path);
 			sieve_script_set_error(script,
 				SIEVE_ERROR_NOT_FOUND,
@@ -163,7 +163,7 @@ static int sieve_dict_script_binary_read_metadata
 	}
 	i_assert( dscript->data_id != NULL );
 	if ( strcmp(str_c(data_id), dscript->data_id) != 0 ) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports different data ID for script `%s' "
 			"(`%s' rather than `%s')",
 			sieve_binary_path(sbin), sieve_script_location(script),
diff --git a/src/lib-sieve/storage/file/sieve-file-script.c b/src/lib-sieve/storage/file/sieve-file-script.c
index 8f63059d5..3c4ec6064 100644
--- a/src/lib-sieve/storage/file/sieve-file-script.c
+++ b/src/lib-sieve/storage/file/sieve-file-script.c
@@ -67,8 +67,7 @@ static void sieve_file_script_handle_error
 			*error_r = SIEVE_ERROR_TEMP_FAILURE;
 			break;
 		}
-		sieve_script_sys_debug(script, "File `%s' not found",
-				       abspath);
+		e_debug(script->event, "File `%s' not found", abspath);
 		sieve_script_set_error(script,
 			SIEVE_ERROR_NOT_FOUND,
 			"Sieve script `%s' not found", name);
@@ -496,7 +495,7 @@ static int sieve_file_script_binary_read_metadata
 		(bstat->st_mtime == sstat->st_mtime &&
 			ST_MTIME_NSEC(*bstat) <= ST_MTIME_NSEC(*sstat)) ) {
 		if ( svinst->debug ) {
-			sieve_script_sys_debug(script,
+			e_debug(script->event,
 				"Sieve binary `%s' is not newer "
 				"than the Sieve script `%s' (%s.%lu <= %s.%lu)",
 				sieve_binary_path(sbin), sieve_script_location(script),
diff --git a/src/lib-sieve/storage/ldap/sieve-ldap-script.c b/src/lib-sieve/storage/ldap/sieve-ldap-script.c
index f59c9fcfd..1c732db09 100644
--- a/src/lib-sieve/storage/ldap/sieve-ldap-script.c
+++ b/src/lib-sieve/storage/ldap/sieve-ldap-script.c
@@ -74,8 +74,7 @@ static int sieve_ldap_script_open
 	if ( (ret=sieve_ldap_db_lookup_script(lstorage->conn,
 		script->name, &lscript->dn, &lscript->modattr)) <= 0 ) {
 		if ( ret == 0 ) {
-			sieve_script_sys_debug(script,
-				"Script entry not found");
+			e_debug(script->event, "Script entry not found");
 			sieve_script_set_error(script,
 				SIEVE_ERROR_NOT_FOUND,
 				"Sieve script not found");
@@ -105,8 +104,7 @@ static int sieve_ldap_script_get_stream
 	if ( (ret=sieve_ldap_db_read_script(
 		lstorage->conn, lscript->dn, stream_r)) <= 0 ) {
 		if ( ret == 0 ) {
-			sieve_script_sys_debug(script,
-				"Script attribute not found");
+			e_debug(script->event, "Script attribute not found");
 			sieve_script_set_error(script,
 				SIEVE_ERROR_NOT_FOUND,
 				"Sieve script not found");
@@ -136,7 +134,7 @@ static int sieve_ldap_script_binary_read_metadata
 	/* config file changed? */
 	if ( bmtime <= lstorage->set_mtime ) {
 		if ( svinst->debug ) {
-			sieve_script_sys_debug(script,
+			e_debug(script->event,
 				"Sieve binary `%s' is not newer "
 				"than the LDAP configuration `%s' (%s <= %s)",
 				sieve_binary_path(sbin), lstorage->config_file,
@@ -171,7 +169,7 @@ static int sieve_ldap_script_binary_read_metadata
 	}
 	i_assert( lscript->dn != NULL );
 	if ( strcmp(str_c(dn), lscript->dn) != 0 ) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports different LDAP DN for script `%s' "
 			"(`%s' rather than `%s')",
 			sieve_binary_path(sbin), sieve_script_location(script),
@@ -188,7 +186,7 @@ static int sieve_ldap_script_binary_read_metadata
 		return -1;
 	}
 	if ( strcmp(str_c(modattr), lscript->modattr) != 0 ) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports different modified attribute content "
 			"for script `%s' (`%s' rather than `%s')",
 			sieve_binary_path(sbin), sieve_script_location(script),
-- 
GitLab