Remove some warnings.

This commit is contained in:
Vsevolod Stakhov 2011-10-14 19:06:02 +03:00
parent 9752a52355
commit 4e9aeb3c4f
10 changed files with 11 additions and 38 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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)) {

View File

@ -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 &&

View File

@ -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;

View File

@ -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) {

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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);
}