commit c978a76: [Minor] Some style neats

Vsevolod Stakhov vsevolod at rspamd.com
Mon Jan 23 22:00:03 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-01-23 21:43:01 +0000
URL: https://github.com/rspamd/rspamd/commit/c978a76a0fbaed446b672be38596785f4bc468e9

[Minor] Some style neats

---
 src/client/rspamc.cxx | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/client/rspamc.cxx b/src/client/rspamc.cxx
index 9fa56decd..2adc80a7c 100644
--- a/src/client/rspamc.cxx
+++ b/src/client/rspamc.cxx
@@ -938,7 +938,7 @@ static void
 rspamc_metric_output(FILE *out, const ucl_object_t *obj)
 {
 	int got_scores = 0;
-	bool is_spam = false, is_skipped = false;
+	bool is_spam = false;
 	double score = 0, required_score = 0, greylist_score =0, addheader_score = 0;
 
 	auto print_protocol_string = [&](const char *ucl_name, const char *output_message) {
@@ -1054,18 +1054,14 @@ rspamc_metric_output(FILE *out, const ucl_object_t *obj)
 	}
 
 	if (humanreport) {
-		/* XXX: why checkv2 does not provide "is_spam"? */
-		elt = ucl_object_lookup(obj, "is_spam");
-		if (elt) {
-			is_spam = ucl_object_toboolean(elt);
-		}
+		auto is_skipped = 0;
 
 		elt = ucl_object_lookup(obj, "is_skipped");
-		if (elt) {
-			is_skipped = ucl_object_toboolean(elt);
+		if (elt && ucl_object_toboolean(elt)) {
+			is_skipped = 1;
 		}
 
-		fmt::print(out, ",spam={},skipped={}\n", is_spam ? 1 : 0, is_skipped ? 1 : 0);
+		fmt::print(out, ",spam={},skipped={}\n", is_spam ? 1 : 0, is_skipped);
 	}
 	else if (got_scores == 2) {
 		fmt::print(out,


More information about the Commits mailing list