aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-08-24 00:54:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-08-24 00:54:09 +0100
commit231c62a4d17fba802eccb2767ee0c77aa3a8ce9f (patch)
treefbfc880770c1b4c4efc6554f0d2cc674f43abfb5
parent65dd73840b8795f6744ed02570027ef3d840ef75 (diff)
downloadrspamd-231c62a4d17fba802eccb2767ee0c77aa3a8ce9f.tar.gz
rspamd-231c62a4d17fba802eccb2767ee0c77aa3a8ce9f.zip
Do not use calculations in macroes.
-rw-r--r--src/bloom.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/bloom.c b/src/bloom.c
index 3db8faa9c..d74d395c9 100644
--- a/src/bloom.c
+++ b/src/bloom.c
@@ -204,9 +204,11 @@ bloom_add (bloom_filter_t * bloom, const gchar *s)
{
size_t n;
u_char t;
+ guint v;
for (n = 0; n < bloom->nfuncs; ++n) {
- INCBIT (bloom->a, bloom->funcs[n] (s) % bloom->asize, t);
+ v = bloom->funcs[n] (s) % bloom->asize;
+ INCBIT (bloom->a, v, t);
}
return TRUE;
@@ -217,9 +219,11 @@ bloom_del (bloom_filter_t * bloom, const gchar *s)
{
size_t n;
u_char t;
+ guint v;
for (n = 0; n < bloom->nfuncs; ++n) {
- DECBIT (bloom->a, bloom->funcs[n] (s) % bloom->asize, t);
+ v = bloom->funcs[n] (s) % bloom->asize;
+ DECBIT (bloom->a, v, t);
}
return TRUE;
@@ -230,9 +234,11 @@ gboolean
bloom_check (bloom_filter_t * bloom, const gchar *s)
{
size_t n;
+ guint v;
for (n = 0; n < bloom->nfuncs; ++n) {
- if (!(GETBIT (bloom->a, bloom->funcs[n] (s) % bloom->asize)))
+ v = bloom->funcs[n] (s) % bloom->asize;
+ if (!(GETBIT (bloom->a, v)))
return FALSE;
}