diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-11 15:38:27 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-11 15:38:48 +0100 |
commit | c9bb2fe5d30f40e910295241c2ae81cc1d1b8b8d (patch) | |
tree | 950ba4dbb5ed6296ec587ddec7477a988a535365 /src/libmime/message.c | |
parent | 73137f58b41251baf87355487d1891bd4d68d11c (diff) | |
download | rspamd-c9bb2fe5d30f40e910295241c2ae81cc1d1b8b8d.tar.gz rspamd-c9bb2fe5d30f40e910295241c2ae81cc1d1b8b8d.zip |
[Minor] Move some of mempool magic constants to a separate file
Diffstat (limited to 'src/libmime/message.c')
-rw-r--r-- | src/libmime/message.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c index 1d0783d9b..1d61b9807 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -24,6 +24,7 @@ #include "smtp_parsers.h" #include "mime_parser.h" #include "mime_encoding.h" +#include "libserver/mempool_vars_internal.h" #ifdef WITH_SNOWBALL #include "libstemmer.h" @@ -291,26 +292,26 @@ rspamd_extract_words (struct rspamd_task *task, gdouble *avg_len_p, *short_len_p; avg_len_p = rspamd_mempool_get_variable (task->task_pool, - "avg_words_len"); + RSPAMD_MEMPOOL_AVG_WORDS_LEN); if (avg_len_p == NULL) { avg_len_p = rspamd_mempool_alloc (task->task_pool, sizeof (double)); *avg_len_p = total_len; rspamd_mempool_set_variable (task->task_pool, - "avg_words_len", avg_len_p, NULL); + RSPAMD_MEMPOOL_AVG_WORDS_LEN, avg_len_p, NULL); } else { *avg_len_p += total_len; } short_len_p = rspamd_mempool_get_variable (task->task_pool, - "short_words_cnt"); + RSPAMD_MEMPOOL_SHORT_WORDS_CNT); if (short_len_p == NULL) { short_len_p = rspamd_mempool_alloc (task->task_pool, sizeof (double)); *short_len_p = short_len; rspamd_mempool_set_variable (task->task_pool, - "short_words_cnt", avg_len_p, NULL); + RSPAMD_MEMPOOL_SHORT_WORDS_CNT, avg_len_p, NULL); } else { *short_len_p += short_len; @@ -950,13 +951,15 @@ rspamd_message_parse (struct rspamd_task *task) } if (total_words > 0) { - var = rspamd_mempool_get_variable (task->task_pool, "avg_words_len"); + var = rspamd_mempool_get_variable (task->task_pool, + RSPAMD_MEMPOOL_AVG_WORDS_LEN); if (var) { *var /= (double)total_words; } - var = rspamd_mempool_get_variable (task->task_pool, "short_words_cnt"); + var = rspamd_mempool_get_variable (task->task_pool, + RSPAMD_MEMPOOL_SHORT_WORDS_CNT); if (var) { *var /= (double)total_words; |