From f9eb3b97eb2a308685aac5d5e538e1cc85c3c839 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 10 Mar 2017 16:06:16 +0000 Subject: [PATCH] [Minor] Remove some unused variables --- src/controller.c | 2 -- src/fuzzy_storage.c | 5 ----- src/libmime/message.c | 3 +-- src/libserver/dkim.c | 6 ++---- src/libserver/html_colors.h | 2 +- src/log_helper.c | 1 + src/plugins/chartable.c | 6 ++---- src/plugins/dkim_check.c | 4 ++-- src/ragel/rfc2047_parser.rl | 4 +--- 9 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/controller.c b/src/controller.c index 8406b6236..dd95f768d 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1531,11 +1531,9 @@ static gboolean rspamd_controller_lua_fin_task (void *ud) { struct rspamd_task *task = ud; - struct rspamd_controller_session *session; struct rspamd_http_connection_entry *conn_ent; conn_ent = task->fin_arg; - session = conn_ent->ud; if (task->err != NULL) { rspamd_controller_send_error (conn_ent, task->err->code, "%s", diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 7b939d3f0..b88090228 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -747,26 +747,21 @@ rspamd_fuzzy_check_callback (struct rspamd_fuzzy_reply *result, void *ud) struct fuzzy_session *session = ud; gboolean encrypted = FALSE, is_shingle = FALSE; struct rspamd_fuzzy_cmd *cmd = NULL; - gsize up_len = 0; switch (session->cmd_type) { case CMD_NORMAL: cmd = &session->cmd.normal; - up_len = sizeof (session->cmd.normal); break; case CMD_SHINGLE: cmd = &session->cmd.shingle.basic; - up_len = sizeof (session->cmd.shingle); is_shingle = TRUE; break; case CMD_ENCRYPTED_NORMAL: cmd = &session->cmd.enc_normal.cmd; - up_len = sizeof (session->cmd.normal); encrypted = TRUE; break; case CMD_ENCRYPTED_SHINGLE: cmd = &session->cmd.enc_shingle.cmd.basic; - up_len = sizeof (session->cmd.shingle); encrypted = TRUE; is_shingle = TRUE; break; diff --git a/src/libmime/message.c b/src/libmime/message.c index 40769037b..c429892aa 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -287,7 +287,7 @@ rspamd_normalize_text_part (struct rspamd_task *task, struct rspamd_mime_text_part *part) { - const guchar *p, *c, *end; + const guchar *p, *end; guint i; goffset off; struct rspamd_process_exception *ex; @@ -296,7 +296,6 @@ rspamd_normalize_text_part (struct rspamd_task *task, part->stripped_content = g_byte_array_sized_new (part->content->len); part->newlines = g_ptr_array_sized_new (128); p = part->content->data; - c = p; end = p + part->content->len; rspamd_strip_newlines_parse (p, end, part->stripped_content, diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c index 4ef2ad122..9254443ba 100644 --- a/src/libserver/dkim.c +++ b/src/libserver/dkim.c @@ -1800,7 +1800,7 @@ rspamd_dkim_check (rspamd_dkim_context_t *ctx, rspamd_dkim_key_t *key, struct rspamd_task *task) { - const gchar *p, *body_end, *body_start; + const gchar *body_end, *body_start; guchar raw_digest[EVP_MAX_MD_SIZE]; EVP_MD_CTX *cpy_ctx; gsize dlen; @@ -1814,7 +1814,6 @@ rspamd_dkim_check (rspamd_dkim_context_t *ctx, g_return_val_if_fail (task->msg.len > 0, DKIM_ERROR); /* First of all find place of body */ - p = task->msg.begin; body_end = task->msg.begin + task->msg.len; body_start = task->raw_headers_content.body_start; @@ -2161,7 +2160,7 @@ rspamd_dkim_sign (struct rspamd_task *task, { GString *hdr; struct rspamd_dkim_header *dh; - const gchar *p, *body_end, *body_start; + const gchar *body_end, *body_start; guchar raw_digest[EVP_MAX_MD_SIZE]; gsize dlen; guint i, j; @@ -2172,7 +2171,6 @@ rspamd_dkim_sign (struct rspamd_task *task, g_assert (ctx != NULL); /* First of all find place of body */ - p = task->msg.begin; body_end = task->msg.begin + task->msg.len; body_start = task->raw_headers_content.body_start; diff --git a/src/libserver/html_colors.h b/src/libserver/html_colors.h index 78e727d4a..00fa6fed5 100644 --- a/src/libserver/html_colors.h +++ b/src/libserver/html_colors.h @@ -25,7 +25,7 @@ struct rspamd_html_colorname { const gchar *name; }; -const static struct rspamd_html_colorname html_colornames[] = { +static const struct rspamd_html_colorname html_colornames[] = { { {240, 248, 255}, "aliceblue"}, { {250, 235, 215}, "antiquewhite"}, { {255, 239, 219}, "antiquewhite1"}, diff --git a/src/log_helper.c b/src/log_helper.c index 974649d87..d66f49271 100644 --- a/src/log_helper.c +++ b/src/log_helper.c @@ -64,6 +64,7 @@ init_log_helper (struct rspamd_config *cfg) GQuark type; type = g_quark_try_string ("log_helper"); + (void)type; ctx = rspamd_mempool_alloc (cfg->cfg_pool, sizeof (*ctx)); ctx->magic = rspamd_log_helper_magic; diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c index c73ef13c9..d6efc3ed2 100644 --- a/src/plugins/chartable.c +++ b/src/plugins/chartable.c @@ -170,7 +170,7 @@ rspamd_chartable_process_word_utf (struct rspamd_task *task, rspamd_stat_token_t *w, gboolean is_url) { - const gchar *p, *end, *c; + const gchar *p, *end; gdouble badness = 0.0; UChar32 uc; UBlockCode sc, last_sc; @@ -184,7 +184,6 @@ rspamd_chartable_process_word_utf (struct rspamd_task *task, p = w->begin; end = p + w->len; - c = p; last_sc = 0; /* We assume that w is normalized */ @@ -271,7 +270,7 @@ rspamd_chartable_process_word_ascii (struct rspamd_task *task, rspamd_stat_token_t *w, gboolean is_url) { - const guchar *p, *end, *c; + const guchar *p, *end; gdouble badness = 0.0; enum { ascii = 1, @@ -287,7 +286,6 @@ rspamd_chartable_process_word_ascii (struct rspamd_task *task, p = w->begin; end = p + w->len; - c = p; last_sc = 0; if (w->len > chartable_module_ctx->max_word_len) { diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c index 808b19f17..87203b5d5 100644 --- a/src/plugins/dkim_check.c +++ b/src/plugins/dkim_check.c @@ -282,7 +282,7 @@ gint dkim_module_config (struct rspamd_config *cfg) { const ucl_object_t *value; - gint res = TRUE, cb_id = -1, check_id = -1; + gint res = TRUE, cb_id = -1; guint cache_size; gboolean got_trusted = FALSE; @@ -511,7 +511,7 @@ dkim_module_config (struct rspamd_config *cfg) dkim_module_ctx->dkim_pool, dkim_module_ctx->sign_condition_ref); - check_id = rspamd_symbols_cache_add_symbol (cfg->cache, + rspamd_symbols_cache_add_symbol (cfg->cache, "DKIM_SIGN", 0, dkim_sign_callback, diff --git a/src/ragel/rfc2047_parser.rl b/src/ragel/rfc2047_parser.rl index 9a863fc9a..05b08a6ae 100644 --- a/src/ragel/rfc2047_parser.rl +++ b/src/ragel/rfc2047_parser.rl @@ -62,13 +62,11 @@ rspamd_rfc2047_parser (const gchar *in, gsize len, gint *pencoding, const gchar **charset, gsize *charset_len, const gchar **encoded, gsize *encoded_len) { - const char *p = in, *pe = in + len, *eof, + const char *p = in, *pe = in + len, *encoded_start = NULL, *encoded_end = NULL, *charset_start = NULL, *charset_end = NULL; gint encoding = RSPAMD_RFC2047_QP, cs = 0; - eof = pe; - %% write init; %% write exec; -- 2.39.5