commit e540a3d: [Minor] Declare variable where it is used

Vsevolod Stakhov vsevolod at rspamd.com
Mon Sep 5 22:42:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-09-05 23:34:43 +0100
URL: https://github.com/rspamd/rspamd/commit/e540a3db85f394c4ab3b53e100be9353b4027066 (HEAD -> master)

[Minor] Declare variable where it is used

---
 src/controller.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/controller.c b/src/controller.c
index adebce251..28677a906 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -2580,7 +2580,6 @@ rspamd_controller_stat_fin_task (void *ud)
 	struct rspamd_stat_cbdata *cbdata = ud;
 	struct rspamd_http_connection_entry *conn_ent;
 	ucl_object_t *top, *ar;
-	GList *fuzzy_elts, *cur;
 	struct rspamd_fuzzy_stat_entry *entry;
 
 	conn_ent = cbdata->conn_ent;
@@ -2593,12 +2592,12 @@ rspamd_controller_stat_fin_task (void *ud)
 		ucl_object_insert_key (top, cbdata->stat, "statfiles", 0, false);
 	}
 
-	fuzzy_elts = rspamd_mempool_get_variable (cbdata->task->task_pool, "fuzzy_stat");
+	GList *fuzzy_elts = rspamd_mempool_get_variable (cbdata->task->task_pool, "fuzzy_stat");
 
 	if (fuzzy_elts) {
 		ar = ucl_object_typed_new (UCL_OBJECT);
 
-		for (cur = fuzzy_elts; cur != NULL; cur = g_list_next (cur)) {
+		for (GList *cur = fuzzy_elts; cur != NULL; cur = g_list_next (cur)) {
 			entry = cur->data;
 
 			if (entry->name) {
@@ -2821,7 +2820,6 @@ rspamd_controller_metrics_fin_task (void *ud) {
 	struct rspamd_stat_cbdata *cbdata = ud;
 	struct rspamd_http_connection_entry *conn_ent;
 	ucl_object_t *top;
-	GList *fuzzy_elts, *cur;
 	struct rspamd_fuzzy_stat_entry *entry;
 	rspamd_fstring_t *output;
 	gint i;
@@ -3048,12 +3046,12 @@ rspamd_controller_metrics_fin_task (void *ud) {
 		rspamd_fstring_free (users);
 	}
 
-	fuzzy_elts = rspamd_mempool_get_variable (cbdata->task->task_pool, "fuzzy_stat");
+	GList *fuzzy_elts = rspamd_mempool_get_variable (cbdata->task->task_pool, "fuzzy_stat");
 
 	if (fuzzy_elts) {
 		rspamd_printf_fstring (&output, "# HELP rspamd_fuzzy_stat Fuzzy stat labelled by storage.\n");
 		rspamd_printf_fstring (&output, "# TYPE rspamd_fuzzy_stat gauge\n");
-		for (cur = fuzzy_elts; cur != NULL; cur = g_list_next (cur)) {
+		for (GList *cur = fuzzy_elts; cur != NULL; cur = g_list_next (cur)) {
 			entry = cur->data;
 
 			if (entry->name) {


More information about the Commits mailing list