}
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;
}
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
/*
* 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);
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;
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));
/* 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));
GHashTable **t = st;
gint level = 0;
const gchar *p = key;
- rspamd_fstring_t *val;
-
+ rspamd_ftok_t *val;
while (*p) {
if (*p == '.') {
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);
}
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,
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);
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;