diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-13 17:46:50 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-13 17:46:50 +0100 |
commit | d2a938d398d31fae55e709a4e219b5acfa5c7622 (patch) | |
tree | 616ee4dacde622e13ee26f4437febf9e5eae4661 /src/libstat/learn_cache | |
parent | 444c70ff896dcd07f1569e394b528cf1f61dec54 (diff) | |
download | rspamd-d2a938d398d31fae55e709a4e219b5acfa5c7622.tar.gz rspamd-d2a938d398d31fae55e709a4e219b5acfa5c7622.zip |
Rework parts and task structure:
- Now text_parts, parts and received are arrays
- Pre-allocate arrays with some reasonable defaults
- Use arrays instead of lists in plugins and checks
- Remove unused fields from task structure
- Rework mime_foreach callback function
- Remove deprecated scan_milliseconds field
Diffstat (limited to 'src/libstat/learn_cache')
-rw-r--r-- | src/libstat/learn_cache/sqlite3_cache.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/libstat/learn_cache/sqlite3_cache.c b/src/libstat/learn_cache/sqlite3_cache.c index fa366877e..ebfb5510c 100644 --- a/src/libstat/learn_cache/sqlite3_cache.c +++ b/src/libstat/learn_cache/sqlite3_cache.c @@ -247,24 +247,20 @@ rspamd_stat_cache_sqlite3_process (struct rspamd_task *task, blake2b_state st; rspamd_fstring_t *word; guchar out[BLAKE2B_OUTBYTES]; - GList *cur; - guint i; + guint i, j; if (ctx != NULL && ctx->db != NULL) { blake2b_init (&st, sizeof (out)); - cur = task->text_parts; - while (cur) { - part = (struct mime_text_part *)cur->data; + for (i = 0; i < task->text_parts->len; i ++) { + part = g_ptr_array_index (task->text_parts, i); if (part->words != NULL) { - for (i = 0; i < part->words->len; i ++) { - word = &g_array_index (part->words, rspamd_fstring_t, i); + for (j = 0; j < part->words->len; j ++) { + word = &g_array_index (part->words, rspamd_fstring_t, j); blake2b_update (&st, word->begin, word->len); } } - - cur = g_list_next (cur); } blake2b_final (&st, out, sizeof (out)); |