aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-20 17:34:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-20 17:34:15 +0100
commitfc91dd7a8186ef9d4d9f2e861f5d6e482033e748 (patch)
treea49d39e4d6d9b5e524197615e0a00aeff8682244 /src/libutil/util.c
parent7e785d608880eae1ed9698ded30b83de944c1095 (diff)
downloadrspamd-fc91dd7a8186ef9d4d9f2e861f5d6e482033e748.tar.gz
rspamd-fc91dd7a8186ef9d4d9f2e861f5d6e482033e748.zip
Use caseless hash and equal functions for request headers.
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r--src/libutil/util.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index 90352f28e..5e3e9c4e1 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -1316,6 +1316,27 @@ rspamd_fstring_icase_hash (gconstpointer key)
return rspamd_icase_hash (f->begin, f->len);
}
+gboolean
+rspamd_gstring_icase_equal (gconstpointer v, gconstpointer v2)
+{
+ const GString *f1 = v, *f2 = v2;
+ if (f1->len == f2->len &&
+ g_ascii_strncasecmp (f1->str, f2->str, f1->len) == 0) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+guint
+rspamd_gstring_icase_hash (gconstpointer key)
+{
+ const GString *f = key;
+
+ return rspamd_icase_hash (f->str, f->len);
+}
+
void
gperf_profiler_init (struct rspamd_config *cfg, const gchar *descr)
{