From 4e9aeb3c4ffc69daff061c8b870f1a228bb78175 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 14 Oct 2011 19:06:02 +0300 Subject: [PATCH] Remove some warnings. --- src/map.c | 8 -------- src/message.c | 5 +---- src/plugins/regexp.c | 2 -- src/plugins/surbl.c | 3 --- src/printf.c | 7 ++----- src/radix.c | 2 -- src/settings.c | 4 ---- src/statfile.c | 6 +++--- src/upstream.c | 8 ++++---- src/util.c | 4 +--- 10 files changed, 11 insertions(+), 38 deletions(-) diff --git a/src/map.c b/src/map.c index 300f2eb83..b37082bd0 100644 --- a/src/map.c +++ b/src/map.c @@ -1044,14 +1044,6 @@ start_map_watch (void) void remove_all_maps (void) { - GList *cur = maps; - struct rspamd_map *map; - - /* First of all do synced read of data */ - while (cur) { - map = cur->data; - cur = g_list_next (cur); - } g_list_free (maps); maps = NULL; if (map_pool != NULL) { diff --git a/src/message.c b/src/message.c index c0937e0be..0298a97e5 100644 --- a/src/message.c +++ b/src/message.c @@ -36,7 +36,7 @@ GByteArray * strip_html_tags (struct worker_task *task, memory_pool_t * pool, struct mime_text_part *part, GByteArray * src, gint *stateptr) { - uint8_t *tbuf = NULL, *p, *tp = NULL, *rp, *tbegin = NULL, *end, c, lc; + uint8_t *p, *rp, *tbegin = NULL, *end, c, lc; gint br, i = 0, depth = 0, in_q = 0; gint state = 0; GByteArray *buf; @@ -124,19 +124,16 @@ unbreak_tag: case 2: /* PHP */ if (!br && lc != '\"' && *(p - 1) == '?') { in_q = state = 0; - tp = tbuf; } break; case 3: in_q = state = 0; - tp = tbuf; break; case 4: /* JavaScript/CSS/etc... */ if (p >= src->data + 2 && *(p - 1) == '-' && *(p - 2) == '-') { in_q = state = 0; - tp = tbuf; } break; diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index b79997394..df3675e93 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -302,7 +302,6 @@ json_regexp_fin_cb (memory_pool_t * pool, struct map_cb_data *data) json_error_t je; gchar *cur_rule, *cur_symbol; double score; - gboolean enabled; struct regexp_module_item *cur_item; GList *cur_networks = NULL; struct dynamic_map_item *cur_nitem; @@ -356,7 +355,6 @@ json_regexp_fin_cb (memory_pool_t * pool, struct map_cb_data *data) for (i = 0; i < nelts; i++) { cur_networks = NULL; cur_rule = NULL; - enabled = TRUE; cur_elt = json_array_get (js, i); if (!cur_elt || !json_is_object (cur_elt)) { diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index d0a51d59b..3c4a0e53f 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -1004,7 +1004,6 @@ surbl_tree_url_callback (gpointer key, gpointer value, void *data) struct redirector_param *param = data; struct worker_task *task; struct uri *url = value; - f_str_t f; gchar *red_domain; const gchar *pos; GRegex *re; @@ -1018,8 +1017,6 @@ surbl_tree_url_callback (gpointer key, gpointer value, void *data) } if (surbl_module_ctx->use_redirector) { - f.begin = url->host; - f.len = url->hostlen; /* Search in trie */ if (surbl_module_ctx->redirector_trie && (pos = rspamd_trie_lookup (surbl_module_ctx->redirector_trie, url->host, url->hostlen, &idx)) != NULL && diff --git a/src/printf.c b/src/printf.c index 97b326547..54919a5c1 100644 --- a/src/printf.c +++ b/src/printf.c @@ -172,13 +172,12 @@ rspamd_sprintf_num (gchar *buf, gchar *last, guint64 ui64, gchar zero, gint rspamd_fprintf (FILE *f, const gchar *fmt, ...) { - gchar *p; va_list args; gchar buf[BUFSIZ]; gint r; va_start (args, fmt); - p = rspamd_vsnprintf (buf, sizeof (buf), fmt, args); + rspamd_vsnprintf (buf, sizeof (buf), fmt, args); va_end (args); r = fprintf (f, "%s", buf); @@ -277,7 +276,7 @@ rspamd_vsnprintf (gchar *buf, glong max, const gchar *fmt, va_list args) size_t len, slen; gint64 i64; guint64 ui64; - guint width, sign, hex, humanize, bytes, max_width, frac_width, i; + guint width, sign, hex, humanize, bytes, frac_width, i; f_str_t *v; GString *gs; @@ -305,7 +304,6 @@ rspamd_vsnprintf (gchar *buf, glong max, const gchar *fmt, va_list args) hex = 0; bytes = 0; humanize = 0; - max_width = 0; frac_width = 0; slen = (size_t) -1; @@ -323,7 +321,6 @@ rspamd_vsnprintf (gchar *buf, glong max, const gchar *fmt, va_list args) continue; case 'm': - max_width = 1; fmt++; continue; diff --git a/src/radix.c b/src/radix.c index e8a68848d..8bcd910bf 100644 --- a/src/radix.c +++ b/src/radix.c @@ -197,7 +197,6 @@ radix32tree_delete (radix_tree_t * tree, guint32 key, guint32 mask) { guint32 bit; radix_node_t *node; - radix_node_t *tmp; bit = 0x80000000; node = tree->root; @@ -236,7 +235,6 @@ radix32tree_delete (radix_tree_t * tree, guint32 key, guint32 mask) node->parent->left = NULL; } - tmp = node; node = node->parent; if (node->right || node->left) { diff --git a/src/settings.c b/src/settings.c index 31cc95b1c..47766865e 100644 --- a/src/settings.c +++ b/src/settings.c @@ -510,7 +510,6 @@ check_metric_action_settings (struct worker_task *task, struct metric_result *re GList *cur; enum rspamd_metric_action r = METRIC_ACTION_NOACTION; gboolean black; - double rej = 0.; if (us != NULL) { /* Check whitelist and set appropriate action for whitelisted users */ @@ -530,9 +529,6 @@ check_metric_action_settings (struct worker_task *task, struct metric_result *re r = act->action; sel = act; } - if (r == METRIC_ACTION_REJECT) { - rej = act->score; - } cur = g_list_next (cur); } } diff --git a/src/statfile.c b/src/statfile.c index efdb6ad56..26d96a38c 100644 --- a/src/statfile.c +++ b/src/statfile.c @@ -288,7 +288,8 @@ statfile_pool_reindex (statfile_pool_t * pool, gchar *filename, size_t old_size, static void statfile_preload (stat_file_t *file) { - guint8 *pos, *end, t; + guint8 *pos, *end; + volatile guint8 t; gsize size; pos = (guint8 *)file->map; @@ -306,6 +307,7 @@ statfile_preload (stat_file_t *file) #endif while (pos < end) { t = *pos; + (void)t; pos += size; } } @@ -550,7 +552,6 @@ double statfile_pool_get_block (statfile_pool_t * pool, stat_file_t * file, guint32 h1, guint32 h2, time_t now) { struct stat_file_block *block; - struct stat_file_header *header; guint i, blocknum; u_char *c; @@ -561,7 +562,6 @@ statfile_pool_get_block (statfile_pool_t * pool, stat_file_t * file, guint32 h1, } blocknum = h1 % file->cur_section.length; - header = (struct stat_file_header *)file->map; c = (u_char *) file->map + file->seek_pos + blocknum * sizeof (struct stat_file_block); block = (struct stat_file_block *)c; diff --git a/src/upstream.c b/src/upstream.c index d167c88ec..b3f282d59 100644 --- a/src/upstream.c +++ b/src/upstream.c @@ -334,12 +334,12 @@ get_upstream_by_hash (void *ups, size_t members, size_t msize, time_t now, time_ struct upstream * get_upstream_round_robin (void *ups, size_t members, size_t msize, time_t now, time_t error_timeout, time_t revive_timeout, size_t max_errors) { - guint alive, max_weight, i; + guint max_weight, i; struct upstream *cur, *selected = NULL; u_char *p; /* Recheck all upstreams */ - alive = rescan_upstreams (ups, members, msize, now, error_timeout, revive_timeout, max_errors); + (void)rescan_upstreams (ups, members, msize, now, error_timeout, revive_timeout, max_errors); p = ups; max_weight = 0; @@ -383,12 +383,12 @@ get_upstream_round_robin (void *ups, size_t members, size_t msize, time_t now, t struct upstream * get_upstream_master_slave (void *ups, size_t members, size_t msize, time_t now, time_t error_timeout, time_t revive_timeout, size_t max_errors) { - guint alive, max_weight, i; + guint max_weight, i; struct upstream *cur, *selected = NULL; u_char *p; /* Recheck all upstreams */ - alive = rescan_upstreams (ups, members, msize, now, error_timeout, revive_timeout, max_errors); + (void)rescan_upstreams (ups, members, msize, now, error_timeout, revive_timeout, max_errors); p = ups; max_weight = 0; diff --git a/src/util.c b/src/util.c index 9956b8da0..01936474e 100644 --- a/src/util.c +++ b/src/util.c @@ -282,7 +282,7 @@ make_unix_socket (const gchar *path, struct sockaddr_un *addr, gboolean is_serve gint make_socketpair (gint pair[2]) { - gint s_error, r, optlen, serrno, on = 1; + gint r; r = socketpair (PF_LOCAL, SOCK_STREAM, 0, pair); @@ -303,10 +303,8 @@ make_socketpair (gint pair[2]) return 0; out: - serrno = errno; close (pair[0]); close (pair[1]); - errno = serrno; return (-1); } -- 2.39.5