commit 85b5b1b: [Minor] Remove unreachable code

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Sep 25 12:07:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-09-25 12:19:39 +0100
URL: https://github.com/rspamd/rspamd/commit/85b5b1b4c50376a67be0a9adc03f04598626ec01

[Minor] Remove unreachable code

---
 src/libserver/logger.h        |  2 +-
 src/libserver/logger/logger.c | 16 ++--------------
 2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/libserver/logger.h b/src/libserver/logger.h
index 18662d31d..b646aa3fd 100644
--- a/src/libserver/logger.h
+++ b/src/libserver/logger.h
@@ -150,7 +150,7 @@ bool rspamd_common_logv (rspamd_logger_t *logger, gint level_flags,
  * @param mod
  * @return
  */
-guint rspamd_logger_add_debug_module (const gchar *mod);
+gint rspamd_logger_add_debug_module (const gchar *mod);
 
 /*
  * Macro to use for faster debug modules
diff --git a/src/libserver/logger/logger.c b/src/libserver/logger/logger.c
index 07625bb91..4fdfd3cba 100644
--- a/src/libserver/logger/logger.c
+++ b/src/libserver/logger/logger.c
@@ -449,18 +449,6 @@ rspamd_common_logv (rspamd_logger_t *rspamd_log, gint level_flags,
 		/* Just fprintf message to stderr */
 		if (level >= G_LOG_LEVEL_INFO) {
 			end = rspamd_vsnprintf (logbuf, sizeof (logbuf), fmt, args);
-
-			if (!(rspamd_log->flags & RSPAMD_LOG_FLAG_RSPAMADM)) {
-				if ((nescaped = rspamd_log_line_need_escape (logbuf, end - logbuf)) != 0) {
-					gsize unsecaped_len = end - logbuf;
-					gchar *logbuf_escaped = g_alloca (unsecaped_len + nescaped * 4);
-					log_line = logbuf_escaped;
-
-					end = rspamd_log_line_hex_escape (logbuf, unsecaped_len,
-							logbuf_escaped, unsecaped_len + nescaped * 4);
-				}
-			}
-
 			rspamd_fprintf (stderr, "%*s\n", (gint)(end - log_line),
 					log_line);
 		}
@@ -859,13 +847,13 @@ RSPAMD_DESTRUCTOR (rspamd_debug_modules_dtor)
 	}
 }
 
-guint
+gint
 rspamd_logger_add_debug_module (const gchar *mname)
 {
 	struct rspamd_log_module *m;
 
 	if (mname == NULL) {
-		return (guint)-1;
+		return -1;
 	}
 
 	if (log_modules == NULL) {


More information about the Commits mailing list