@@ -215,12 +215,12 @@ rspamd_str_equal (gconstpointer v, gconstpointer v2) | |||
} | |||
gboolean | |||
rspamd_fstring_icase_equal (gconstpointer v, gconstpointer v2) | |||
rspamd_ftok_icase_equal (gconstpointer v, gconstpointer v2) | |||
{ | |||
const rspamd_fstring_t *f1 = v, *f2 = v2; | |||
const rspamd_ftok_t *f1 = v, *f2 = v2; | |||
if (f1->len == f2->len && | |||
g_ascii_strncasecmp (f1->str, f2->str, f1->len) == 0) { | |||
g_ascii_strncasecmp (f1->begin, f2->begin, f1->len) == 0) { | |||
return TRUE; | |||
} | |||
@@ -229,11 +229,11 @@ rspamd_fstring_icase_equal (gconstpointer v, gconstpointer v2) | |||
guint | |||
rspamd_fstring_icase_hash (gconstpointer key) | |||
rspamd_ftok_icase_hash (gconstpointer key) | |||
{ | |||
const rspamd_fstring_t *f = key; | |||
const rspamd_ftok_t *f = key; | |||
return rspamd_icase_hash (f->str, f->len); | |||
return rspamd_icase_hash (f->begin, f->len); | |||
} | |||
gboolean |
@@ -53,8 +53,8 @@ gboolean rspamd_str_equal (gconstpointer v, gconstpointer v2); | |||
/* | |||
* Hash table utility functions for hashing fixed strings | |||
*/ | |||
guint rspamd_fstring_icase_hash (gconstpointer key); | |||
gboolean rspamd_fstring_icase_equal (gconstpointer v, gconstpointer v2); | |||
guint rspamd_ftok_icase_hash (gconstpointer key); | |||
gboolean rspamd_ftok_icase_equal (gconstpointer v, gconstpointer v2); | |||
guint rspamd_gstring_icase_hash (gconstpointer key); | |||
gboolean rspamd_gstring_icase_equal (gconstpointer v, gconstpointer v2); | |||
@@ -621,7 +621,7 @@ fuzzy_cmd_from_text_part (struct fuzzy_rule *rule, | |||
struct rspamd_shingle *sh; | |||
guint i; | |||
blake2b_state st; | |||
rspamd_fstring_t *word; | |||
rspamd_ftok_t *word; | |||
GArray *words; | |||
struct fuzzy_cmd_io *io; | |||
struct rspamd_http_keypair *lk, *rk; | |||
@@ -645,7 +645,7 @@ fuzzy_cmd_from_text_part (struct fuzzy_rule *rule, | |||
words = fuzzy_preprocess_words (part, pool); | |||
for (i = 0; i < words->len; i ++) { | |||
word = &g_array_index (words, rspamd_fstring_t, i); | |||
word = &g_array_index (words, rspamd_ftok_t, i); | |||
blake2b_update (&st, word->begin, word->len); | |||
} | |||
blake2b_final (&st, shcmd->basic.digest, sizeof (shcmd->basic.digest)); | |||
@@ -1466,7 +1466,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent, | |||
/* Allocate message from string */ | |||
/* XXX: what about encrypted messsages ? */ | |||
task->msg.start = msg->body->str; | |||
task->msg.begin = msg->body->str; | |||
task->msg.len = msg->body->len; | |||
saved = rspamd_mempool_alloc0 (task->task_pool, sizeof (gint)); |
@@ -91,8 +91,7 @@ exception_insert (gpointer st, gconstpointer key, gpointer value) | |||
GHashTable **t = st; | |||
gint level = 0; | |||
const gchar *p = key; | |||
rspamd_fstring_t *val; | |||
rspamd_ftok_t *val; | |||
while (*p) { | |||
if (*p == '.') { | |||
@@ -107,12 +106,12 @@ exception_insert (gpointer st, gconstpointer key, gpointer value) | |||
return; | |||
} | |||
val = g_malloc (sizeof (rspamd_fstring_t)); | |||
val->begin = (gchar *)key; | |||
val = g_malloc (sizeof (rspamd_ftok_t)); | |||
val->begin = key; | |||
val->len = strlen (key); | |||
if (t[level] == NULL) { | |||
t[level] = g_hash_table_new_full (rspamd_fstring_icase_hash, | |||
rspamd_fstring_icase_equal, | |||
t[level] = g_hash_table_new_full (rspamd_ftok_icase_hash, | |||
rspamd_ftok_icase_equal, | |||
g_free, | |||
NULL); | |||
} | |||
@@ -654,7 +653,7 @@ surbl_module_reconfig (struct rspamd_config *cfg) | |||
static gchar * | |||
format_surbl_request (rspamd_mempool_t * pool, | |||
rspamd_fstring_t * hostname, | |||
rspamd_ftok_t * hostname, | |||
struct suffix_item *suffix, | |||
gboolean append_suffix, | |||
GError ** err, | |||
@@ -663,12 +662,12 @@ format_surbl_request (rspamd_mempool_t * pool, | |||
struct rspamd_url *url) | |||
{ | |||
GHashTable *t; | |||
gchar *result = NULL, *dots[MAX_LEVELS], | |||
num_buf[sizeof("18446744073709551616")], *p; | |||
gchar *result = NULL, num_buf[sizeof("18446744073709551616")]; | |||
const gchar *p, *dots[MAX_LEVELS]; | |||
gint len, slen, r, i, dots_num = 0, level = MAX_LEVELS; | |||
gboolean is_numeric = TRUE, found_exception = FALSE; | |||
guint64 ip_num; | |||
rspamd_fstring_t f; | |||
rspamd_ftok_t f; | |||
if (G_LIKELY (suffix != NULL)) { | |||
slen = strlen (suffix->suffix); | |||
@@ -852,7 +851,7 @@ make_surbl_requests (struct rspamd_url *url, struct rspamd_task *task, | |||
struct suffix_item *suffix, gboolean forced, GHashTable *tree) | |||
{ | |||
gchar *surbl_req; | |||
rspamd_fstring_t f; | |||
rspamd_ftok_t f; | |||
GError *err = NULL; | |||
struct dns_param *param; | |||