diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-20 17:34:15 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-20 17:34:15 +0100 |
commit | fc91dd7a8186ef9d4d9f2e861f5d6e482033e748 (patch) | |
tree | a49d39e4d6d9b5e524197615e0a00aeff8682244 /src/libutil/util.c | |
parent | 7e785d608880eae1ed9698ded30b83de944c1095 (diff) | |
download | rspamd-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.c | 21 |
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) { |