aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/shingles.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-28 23:54:00 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-28 23:54:00 +0100
commita47922458216ce76eb5c591096cb8d4bd41f03c3 (patch)
treea5d5b79d030df2e012233999e614d0358f379053 /src/libutil/shingles.c
parentb2b9cfa6161a98d5d4d074573f99fdac6cb24556 (diff)
downloadrspamd-a47922458216ce76eb5c591096cb8d4bd41f03c3.tar.gz
rspamd-a47922458216ce76eb5c591096cb8d4bd41f03c3.zip
[Minor] Further g_slice cleanup
Diffstat (limited to 'src/libutil/shingles.c')
-rw-r--r--src/libutil/shingles.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libutil/shingles.c b/src/libutil/shingles.c
index 3e0c14b3a..240facc4a 100644
--- a/src/libutil/shingles.c
+++ b/src/libutil/shingles.c
@@ -139,13 +139,13 @@ rspamd_shingles_from_text (GArray *input,
row = rspamd_fstring_sized_new (256);
/* Init hashes pipes and keys */
- hashes = g_slice_alloc (sizeof (*hashes) * RSPAMD_SHINGLE_SIZE);
+ hashes = g_malloc (sizeof (*hashes) * RSPAMD_SHINGLE_SIZE);
hlen = input->len > SHINGLES_WINDOW ?
(input->len - SHINGLES_WINDOW + 1) : 1;
keys = rspamd_shingles_get_keys_cached (key);
for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
- hashes[i] = g_slice_alloc (hlen * sizeof (guint64));
+ hashes[i] = g_malloc (hlen * sizeof (guint64));
}
/* Now parse input words into a vector of hashes using rolling window */
@@ -222,10 +222,10 @@ rspamd_shingles_from_text (GArray *input,
for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
res->hashes[i] = filter (hashes[i], hlen,
i, key, filterd);
- g_slice_free1 (hlen * sizeof (guint64), hashes[i]);
+ g_free (hashes[i]);
}
- g_slice_free1 (sizeof (*hashes) * RSPAMD_SHINGLE_SIZE, hashes);
+ g_free (hashes);
rspamd_fstring_free (row);
@@ -258,12 +258,12 @@ rspamd_shingles_from_image (guchar *dct,
}
/* Init hashes pipes and keys */
- hashes = g_slice_alloc (sizeof (*hashes) * RSPAMD_SHINGLE_SIZE);
+ hashes = g_malloc (sizeof (*hashes) * RSPAMD_SHINGLE_SIZE);
hlen = RSPAMD_DCT_LEN / NBBY + 1;
keys = rspamd_shingles_get_keys_cached (key);
for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
- hashes[i] = g_slice_alloc (hlen * sizeof (guint64));
+ hashes[i] = g_malloc (hlen * sizeof (guint64));
}
switch (alg) {
@@ -303,10 +303,10 @@ rspamd_shingles_from_image (guchar *dct,
for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
shingle->hashes[i] = filter (hashes[i], hlen,
i, key, filterd);
- g_slice_free1 (hlen * sizeof (guint64), hashes[i]);
+ g_free (hashes[i]);
}
- g_slice_free1 (sizeof (*hashes) * RSPAMD_SHINGLE_SIZE, hashes);
+ g_free (hashes);
return shingle;
}