aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/shingles.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-29 13:27:09 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-29 13:27:09 +0000
commitc723bb1f30267bd670db6843a9526c2fd28f49cd (patch)
treedf2a3a524bb7091c4f1d0d6d529e3a7a526ab8b9 /src/libutil/shingles.c
parent83628d948ed3c91e620b114b71f3a01fa71c2905 (diff)
downloadrspamd-c723bb1f30267bd670db6843a9526c2fd28f49cd.tar.gz
rspamd-c723bb1f30267bd670db6843a9526c2fd28f49cd.zip
Use fstring instead of gstring
Diffstat (limited to 'src/libutil/shingles.c')
-rw-r--r--src/libutil/shingles.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libutil/shingles.c b/src/libutil/shingles.c
index bc255ec65..390d87056 100644
--- a/src/libutil/shingles.c
+++ b/src/libutil/shingles.c
@@ -39,7 +39,7 @@ rspamd_shingles_generate (GArray *input,
rspamd_sipkey_t keys[RSPAMD_SHINGLE_SIZE];
guchar shabuf[rspamd_cryptobox_HASHBYTES], *out_key;
const guchar *cur_key;
- GString *row;
+ rspamd_fstring_t *row;
rspamd_ftok_t *word;
rspamd_cryptobox_hash_state_t bs;
guint64 val;
@@ -53,7 +53,7 @@ rspamd_shingles_generate (GArray *input,
}
rspamd_cryptobox_hash_init (&bs, NULL, 0);
- row = g_string_sized_new (256);
+ row = rspamd_fstring_sized_new (256);
cur_key = key;
out_key = (guchar *)&keys[0];
@@ -83,7 +83,7 @@ rspamd_shingles_generate (GArray *input,
if (i - beg >= SHINGLES_WINDOW || i == (gint)input->len) {
for (j = beg; j < i; j ++) {
word = &g_array_index (input, rspamd_ftok_t, j);
- g_string_append_len (row, word->begin, word->len);
+ row = rspamd_fstring_append (row, word->begin, word->len);
}
beg++;
@@ -93,7 +93,8 @@ rspamd_shingles_generate (GArray *input,
keys[j]);
g_array_append_val (hashes[j], val);
}
- g_string_assign (row, "");
+
+ row = rspamd_fstring_assign (row, "", 0);
}
}
@@ -104,7 +105,7 @@ rspamd_shingles_generate (GArray *input,
g_array_free (hashes[i], TRUE);
}
- g_string_free (row, TRUE);
+ rspamd_fstring_free (row);
return res;
}