aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/str_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/str_util.c')
-rw-r--r--src/libutil/str_util.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c
index 4f7aa1c97..f798d9eeb 100644
--- a/src/libutil/str_util.c
+++ b/src/libutil/str_util.c
@@ -297,18 +297,38 @@ rspamd_ftok_icase_hash (gconstpointer key)
}
gboolean
+rspamd_ftok_equal (gconstpointer v, gconstpointer v2)
+{
+ const rspamd_ftok_t *f1 = v, *f2 = v2;
+
+ if (f1->len == f2->len &&
+ memcmp (f1->begin, f2->begin, f1->len) == 0) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+guint
+rspamd_ftok_hash (gconstpointer key)
+{
+ const rspamd_ftok_t *f = key;
+
+ return t1ha (f->begin, f->len, rspamd_hash_seed ());
+}
+
+gboolean
rspamd_gstring_icase_equal (gconstpointer v, gconstpointer v2)
{
const GString *f1 = v, *f2 = v2;
if (f1->len == f2->len &&
- rspamd_lc_cmp (f1->str, f2->str, f1->len) == 0) {
+ rspamd_lc_cmp (f1->str, f2->str, f1->len) == 0) {
return TRUE;
}
return FALSE;
}
-
guint
rspamd_gstring_icase_hash (gconstpointer key)
{