commit b2f0dd7: [Minor] Get rid of some compiler warnings

Vsevolod Stakhov vsevolod at rspamd.com
Fri Nov 4 21:14:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-11-04 21:11:33 +0000
URL: https://github.com/rspamd/rspamd/commit/b2f0dd775c6d3f78234c5e2d1118eac21490bbd5 (HEAD -> master)

[Minor] Get rid of some compiler warnings

---
 src/libserver/fuzzy_backend/fuzzy_backend_redis.c | 9 +--------
 src/libserver/http/http_connection.c              | 4 ----
 src/libstat/tokenizers/tokenizers.c               | 2 +-
 src/libutil/expression.c                          | 4 +++-
 src/lua/lua_mimepart.c                            | 1 -
 src/lua/lua_url.c                                 | 2 --
 src/rspamd.c                                      | 2 +-
 7 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/src/libserver/fuzzy_backend/fuzzy_backend_redis.c b/src/libserver/fuzzy_backend/fuzzy_backend_redis.c
index efed2fea2..0b7953bfe 100644
--- a/src/libserver/fuzzy_backend/fuzzy_backend_redis.c
+++ b/src/libserver/fuzzy_backend/fuzzy_backend_redis.c
@@ -1426,7 +1426,7 @@ rspamd_fuzzy_backend_update_redis (struct rspamd_fuzzy_backend *bk,
 	GString *key;
 	struct fuzzy_peer_cmd *io_cmd;
 	struct rspamd_fuzzy_cmd *cmd = NULL;
-	guint nargs, ncommands, cur_shift;
+	guint nargs, cur_shift;
 
 	g_assert (backend != NULL);
 
@@ -1463,7 +1463,6 @@ rspamd_fuzzy_backend_update_redis (struct rspamd_fuzzy_backend *bk,
 	 * DECR <prefix||fuzzy_count>
 	 */
 
-	ncommands = 3; /* For MULTI + EXEC + INCR <src> */
 	nargs = 4;
 
 	for (i = 0; i < updates->len; i ++) {
@@ -1477,33 +1476,27 @@ rspamd_fuzzy_backend_update_redis (struct rspamd_fuzzy_backend *bk,
 		}
 
 		if (cmd->cmd == FUZZY_WRITE) {
-			ncommands += 5;
 			nargs += 17;
 			session->nadded ++;
 
 			if (io_cmd->is_shingle) {
-				ncommands += RSPAMD_SHINGLE_SIZE;
 				nargs += RSPAMD_SHINGLE_SIZE * 4;
 			}
 
 		}
 		else if (cmd->cmd == FUZZY_DEL) {
-			ncommands += 2;
 			nargs += 4;
 			session->ndeleted ++;
 
 			if (io_cmd->is_shingle) {
-				ncommands += RSPAMD_SHINGLE_SIZE;
 				nargs += RSPAMD_SHINGLE_SIZE * 2;
 			}
 		}
 		else if (cmd->cmd == FUZZY_REFRESH) {
-			ncommands += 1;
 			nargs += 3;
 			session->nextended ++;
 
 			if (io_cmd->is_shingle) {
-				ncommands += RSPAMD_SHINGLE_SIZE;
 				nargs += RSPAMD_SHINGLE_SIZE * 3;
 			}
 		}
diff --git a/src/libserver/http/http_connection.c b/src/libserver/http/http_connection.c
index 599810c20..a0cbf0dce 100644
--- a/src/libserver/http/http_connection.c
+++ b/src/libserver/http/http_connection.c
@@ -1256,10 +1256,6 @@ rspamd_http_connection_new_client_keepalive (struct rspamd_http_context *ctx,
 			opts & RSPAMD_HTTP_CLIENT_SSL);
 
 	if (conn) {
-		struct rspamd_http_connection_private *priv;
-
-		priv = conn->priv;
-
 		return conn;
 	}
 
diff --git a/src/libstat/tokenizers/tokenizers.c b/src/libstat/tokenizers/tokenizers.c
index b4f8ac75c..55ee62f85 100644
--- a/src/libstat/tokenizers/tokenizers.c
+++ b/src/libstat/tokenizers/tokenizers.c
@@ -193,7 +193,7 @@ rspamd_tokenize_check_limit (gboolean decay,
 				*prob = G_MAXUINT64;
 			}
 			else {
-				*prob = decay_prob * G_MAXUINT64;
+				*prob = (guint64)(decay_prob * (double)G_MAXUINT64);
 			}
 
 			return TRUE;
diff --git a/src/libutil/expression.c b/src/libutil/expression.c
index e6992a2d8..40fcc2591 100644
--- a/src/libutil/expression.c
+++ b/src/libutil/expression.c
@@ -1339,7 +1339,7 @@ rspamd_ast_process_node (struct rspamd_expression *e, GNode *node,
 	float t1, t2;
 	gdouble val;
 	gboolean calc_ticks = FALSE;
-	const gchar *op_name = NULL;
+	__attribute__((unused)) const gchar *op_name = NULL;
 
 	elt = node->data;
 
@@ -1382,7 +1382,9 @@ rspamd_ast_process_node (struct rspamd_expression *e, GNode *node,
 		break;
 	case ELT_OP:
 		g_assert (node->children != NULL);
+#ifdef DEBUG_EXPRESSIONS
 		op_name = rspamd_expr_op_to_str (elt->p.op.op);
+#endif
 
 		if (elt->p.op.op_flags & RSPAMD_EXPRESSION_NARY) {
 			msg_debug_expression_verbose ("proceed nary operation %s", op_name);
diff --git a/src/lua/lua_mimepart.c b/src/lua/lua_mimepart.c
index 459a78e69..cfc7d3942 100644
--- a/src/lua/lua_mimepart.c
+++ b/src/lua/lua_mimepart.c
@@ -796,7 +796,6 @@ lua_textpart_get_content_oneline (lua_State * L)
 {
 	LUA_TRACE_POINT;
 	struct rspamd_mime_text_part *part = lua_check_textpart (L);
-	struct rspamd_lua_text *t;
 
 	if (part == NULL || IS_TEXT_PART_EMPTY (part)) {
 		lua_pushnil (L);
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index a2ce1d987..39b0293aa 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -742,7 +742,6 @@ lua_url_create (lua_State *L)
 	LUA_TRACE_POINT;
 	rspamd_mempool_t *pool;
 	struct rspamd_lua_text *t;
-	gboolean own_pool = FALSE;
 	struct rspamd_lua_url *u;
 
 	if (lua_type (L, 1) == LUA_TUSERDATA) {
@@ -750,7 +749,6 @@ lua_url_create (lua_State *L)
 		t = lua_check_text_or_string (L, 2);
 	}
 	else {
-		own_pool = TRUE;
 		pool = static_lua_url_pool;
 		t = lua_check_text_or_string (L, 2);
 	}
diff --git a/src/rspamd.c b/src/rspamd.c
index 17c5fc493..464dff9f9 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -1122,7 +1122,7 @@ rspamd_stat_update_handler (struct ev_loop *loop, ev_timer *w, int revents)
 				(new_spam - old_spam) / w->repeat,
 				(new_ham - old_ham) / w->repeat,
 				cnt > 0 ? sum / cnt : 0);
-		setproctitle (proctitle);
+		setproctitle ("%s", proctitle);
 	}
 
 	memcpy (&old_stat, &cur_stat, sizeof (cur_stat));


More information about the Commits mailing list