diff options
Diffstat (limited to 'src/libutil/fuzzy.h')
-rw-r--r-- | src/libutil/fuzzy.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libutil/fuzzy.h b/src/libutil/fuzzy.h index 73bddad79..813599c6b 100644 --- a/src/libutil/fuzzy.h +++ b/src/libutil/fuzzy.h @@ -18,7 +18,7 @@ typedef struct fuzzy_hash_s { guint32 rh; /**< roll hash value */ guint32 h; /**< hash of block */ guint32 hi; /**< current index in hash pipe */ -} fuzzy_hash_t; +} rspamd_fuzzy_t; struct mime_text_part; @@ -28,14 +28,14 @@ struct mime_text_part; * @param pool pool object * @return fuzzy_hash object allocated in pool */ -fuzzy_hash_t * fuzzy_init (f_str_t *in, rspamd_mempool_t *pool); +rspamd_fuzzy_t * rspamd_fuzzy_init (rspamd_fstring_t *in, rspamd_mempool_t *pool); /** * Calculate fuzzy hash for specified byte array * @param in input string * @param pool pool object * @return fuzzy_hash object allocated in pool */ -fuzzy_hash_t * fuzzy_init_byte_array (GByteArray *in, rspamd_mempool_t *pool); +rspamd_fuzzy_t * rspamd_fuzzy_from_byte_array (GByteArray *in, rspamd_mempool_t *pool); /** * Calculate fuzzy hash for specified text part @@ -44,7 +44,7 @@ fuzzy_hash_t * fuzzy_init_byte_array (GByteArray *in, rspamd_mempool_t *pool); * @param max_diff maximum text length to use diff algorithm in comparasions * @return fuzzy_hash object allocated in pool */ -void fuzzy_init_part (struct mime_text_part *part, +void rspamd_fuzzy_from_text_part (struct mime_text_part *part, rspamd_mempool_t *pool, gsize max_diff); @@ -54,23 +54,23 @@ void fuzzy_init_part (struct mime_text_part *part, * @param h2 second hash * @return result in percents 0 - different hashes, 100 - identical hashes */ -gint fuzzy_compare_hashes (fuzzy_hash_t *h1, fuzzy_hash_t *h2); +gint rspamd_fuzzy_compare (rspamd_fuzzy_t *h1, rspamd_fuzzy_t *h2); /* * Compare two text parts and return percents of difference */ -gint fuzzy_compare_parts (struct mime_text_part *p1, struct mime_text_part *p2); +gint rspamd_fuzzy_compare_parts (struct mime_text_part *p1, struct mime_text_part *p2); /* * Calculate levenstein distance between two strings. Note: this algorithm should be used * only for short texts - it runs too slow on long ones. */ -guint32 lev_distance (gchar *s1, gint len1, gchar *s2, gint len2); +guint32 rspamd_levinstein_distance (gchar *s1, gint len1, gchar *s2, gint len2); /* * Hash table utilities */ -gint rspamd_fuzzy_len (fuzzy_hash_t *h); +gint rspamd_fuzzy_len (rspamd_fuzzy_t *h); guint rspamd_fuzzy_hash (gconstpointer key); gboolean rspamd_fuzzy_equal (gconstpointer v1, gconstpointer v2); |