diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-05-28 20:31:10 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-05-28 20:31:10 +0400 |
commit | ae3eb4dfd787052bebc732c3e37b56f0800e1aa2 (patch) | |
tree | 9ffbf987783e0802ed1c6b311e69b42beba0e142 /src/main.c | |
parent | 0c72b8d2de2081e8b8605c86bba3f743387f981f (diff) | |
download | rspamd-ae3eb4dfd787052bebc732c3e37b56f0800e1aa2.tar.gz rspamd-ae3eb4dfd787052bebc732c3e37b56f0800e1aa2.zip |
* New symbols sorter:
- add ability to have dynamic rules inside items cache
- make 3 types of rules: negative, dynamic and static
- make logic of cache more simple by using glib lists instead of arrays
- do checks of symbols in more logically correct way (negative->dynamic->static)
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c index 844a76925..b05315c1c 100644 --- a/src/main.c +++ b/src/main.c @@ -704,7 +704,7 @@ static void print_metrics_cache (struct config_file *cfg) { struct metric *metric; - GList *l; + GList *l, *cur; struct cache_item *item; int i; @@ -718,12 +718,24 @@ print_metrics_cache (struct config_file *cfg) printf ("Cache for metric: %s\n", metric->name); printf ("-----------------------------------------------------------------\n"); printf ("| Pri | Symbol | Weight | Frequency | Avg. time |\n"); - for (i = 0; i < metric->cache->used_items; i++) { - item = &metric->cache->items[i]; + i = 0; + cur = metric->cache->negative_items; + while (cur) { + item = cur->data; printf ("-----------------------------------------------------------------\n"); printf ("| %3d | %22s | %6.1f | %9d | %9.3f |\n", i, item->s->symbol, item->s->weight, item->s->frequency, item->s->avg_time); - + cur = g_list_next (cur); + i ++; + } + cur = metric->cache->static_items; + while (cur) { + item = cur->data; + printf ("-----------------------------------------------------------------\n"); + printf ("| %3d | %22s | %6.1f | %9d | %9.3f |\n", i, item->s->symbol, item->s->weight, item->s->frequency, item->s->avg_time); + cur = g_list_next (cur); + i ++; } + printf ("-----------------------------------------------------------------\n"); } l = g_list_next (l); |