aboutsummaryrefslogtreecommitdiffstats
path: root/test/rspamd_shingles_test.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-06 17:15:04 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-06 17:15:04 +0100
commitc1d4aa8b69c43a057695ea69a098b87200121e85 (patch)
tree4ec32e714ad86aa5d59523d16304ae15ff419cac /test/rspamd_shingles_test.c
parentf6240cced088030abb377c5e10bcbd0943e3f2b2 (diff)
downloadrspamd-c1d4aa8b69c43a057695ea69a098b87200121e85.tar.gz
rspamd-c1d4aa8b69c43a057695ea69a098b87200121e85.zip
Fix tests.
Diffstat (limited to 'test/rspamd_shingles_test.c')
-rw-r--r--test/rspamd_shingles_test.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/test/rspamd_shingles_test.c b/test/rspamd_shingles_test.c
index 433fe8c67..3a1dd8ba2 100644
--- a/test/rspamd_shingles_test.c
+++ b/test/rspamd_shingles_test.c
@@ -42,16 +42,18 @@ generate_fuzzy_words (gsize cnt, gsize max_len)
{
GArray *res;
gsize i, wlen;
- rspamd_fstring_t w;
+ rspamd_ftok_t w;
+ char *t;
- res = g_array_sized_new (FALSE, FALSE, sizeof (rspamd_fstring_t), cnt);
+ res = g_array_sized_new (FALSE, FALSE, sizeof (rspamd_ftok_t), cnt);
for (i = 0; i < cnt; i ++) {
wlen = ottery_rand_range (max_len) + 1;
- w.len = w.size = wlen;
- w.begin = g_malloc (wlen);
- generate_random_string (w.begin, wlen);
+ w.len = wlen;
+ t = g_malloc (wlen);
+ generate_random_string (t, wlen);
+ w.begin = t;
g_array_append_val (res, w);
}
@@ -62,12 +64,12 @@ static void
permute_vector (GArray *in, gdouble prob)
{
gsize i, total = 0;
- rspamd_fstring_t *w;
+ rspamd_ftok_t *w;
for (i = 0; i < in->len; i ++) {
if (ottery_rand_unsigned () <= G_MAXUINT * prob) {
- w = &g_array_index (in, rspamd_fstring_t, i);
- generate_random_string (w->begin, w->len);
+ w = &g_array_index (in, rspamd_ftok_t, i);
+ generate_random_string ((gchar *)w->begin, w->len);
total ++;
}
}
@@ -78,11 +80,11 @@ static void
free_fuzzy_words (GArray *ar)
{
gsize i;
- rspamd_fstring_t *w;
+ rspamd_ftok_t *w;
for (i = 0; i < ar->len; i ++) {
- w = &g_array_index (ar, rspamd_fstring_t, i);
- g_free (w->begin);
+ w = &g_array_index (ar, rspamd_ftok_t, i);
+ g_free ((gpointer)w->begin);
}
}