commit 1bb4bec: [Minor] Improve readability of recently changed rspamc code
Anton Yuzhaninov
citrin+git at citrin.ru
Wed Sep 22 17:14:05 UTC 2021
Author: Anton Yuzhaninov
Date: 2021-09-21 11:14:10 +0100
URL: https://github.com/rspamd/rspamd/commit/1bb4bec6be3d30cdca78a90e361b10163331e1a0 (refs/pull/3901/head)
[Minor] Improve readability of recently changed rspamc code
---
src/client/rspamc.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 869a82b03..4bb632121 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -1035,8 +1035,6 @@ rspamc_counters_output (FILE *out, ucl_object_t *obj)
const ucl_object_t *cur, *sym, *weight, *freq, *freq_dev, *nhits;
ucl_object_iter_t iter = NULL;
gchar fmt_buf[64], dash_buf[82], sym_buf[82];
- gint l, i;
- gint max_len = sizeof("Symbol") - 1;
static const gint dashes = 44;
if (obj->type != UCL_ARRAY) {
@@ -1050,12 +1048,12 @@ rspamc_counters_output (FILE *out, ucl_object_t *obj)
}
/* Find maximum width of symbol's name */
+ gint max_len = sizeof("Symbol") - 1;
while ((cur = ucl_object_iterate (obj, &iter, true)) != NULL) {
sym = ucl_object_lookup (cur, "symbol");
if (sym != NULL) {
- l = sym->len;
- if (l > max_len) {
- max_len = l;
+ if (sym->len > max_len) {
+ max_len = sym->len;
}
}
}
@@ -1081,7 +1079,7 @@ rspamc_counters_output (FILE *out, ucl_object_t *obj)
"| %%3d | %%%ds | %%7.1f | %%6.3f(%%5.3f) | %%7ju |\n", max_len);
iter = NULL;
- i = 0;
+ gint i = 0;
while ((cur = ucl_object_iterate (obj, &iter, true)) != NULL) {
printf (" %s \n", dash_buf);
sym = ucl_object_lookup (cur, "symbol");
More information about the Commits
mailing list