diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-03-04 17:59:51 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-03-04 17:59:51 +0000 |
commit | ba5e0c97122da57861ffb79dbd44d81bb8e63964 (patch) | |
tree | c0cf96928b632c6aff2f69bf5b403e2f808e0e6f /src/webui.c | |
parent | ccd3363a7b8bed0ebf3dd9bdafe1ba945e5fccff (diff) | |
download | rspamd-ba5e0c97122da57861ffb79dbd44d81bb8e63964.tar.gz rspamd-ba5e0c97122da57861ffb79dbd44d81bb8e63964.zip |
Fix comma in json output.
Diffstat (limited to 'src/webui.c')
-rw-r--r-- | src/webui.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/webui.c b/src/webui.c index 52b33ffaa..c3788f925 100644 --- a/src/webui.c +++ b/src/webui.c @@ -1205,7 +1205,7 @@ http_handle_history (struct evhttp_request *req, gpointer arg) struct evbuffer *evb; struct roll_history_row *row; struct roll_history copied_history; - gint i, row_num; + gint i, rows_proc, row_num; struct tm *tm; gchar timebuf[32]; gchar ip_buf[INET6_ADDRSTRLEN]; @@ -1233,14 +1233,14 @@ http_handle_history (struct evhttp_request *req, gpointer arg) /* Go throught all rows */ row_num = copied_history.cur_row; - for (i = 0; i < HISTORY_MAX_ROWS; i ++, row_num ++) { + for (i = 0, rows_proc = 0; i < HISTORY_MAX_ROWS; i ++, row_num ++) { if (row_num == HISTORY_MAX_ROWS) { row_num = 0; } row = &copied_history.rows[row_num]; /* Get only completed rows */ if (row->completed) { - if (i != 0) { + if (rows_proc != 0) { evbuffer_add (evb, ",", 1); } tm = localtime (&row->tv.tv_sec); @@ -1267,6 +1267,7 @@ http_handle_history (struct evhttp_request *req, gpointer arg) timebuf, row->message_id, ip_buf, str_action_metric (row->action), row->score, row->required_score, row->symbols, row->len, row->scan_time); } + rows_proc ++; } } |