From ad837700b86153be3587672124ee663c964f0f15 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 20 Apr 2014 08:16:49 -0700 Subject: Refactor memory pool naming. --- src/tokenizers/osb.c | 12 ++++++------ src/tokenizers/tokenizers.c | 10 +++++----- src/tokenizers/tokenizers.h | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/tokenizers') diff --git a/src/tokenizers/osb.c b/src/tokenizers/osb.c index c59536b31..823e1e5b5 100644 --- a/src/tokenizers/osb.c +++ b/src/tokenizers/osb.c @@ -35,7 +35,7 @@ extern const int primes[]; int -osb_tokenize_text (struct tokenizer *tokenizer, memory_pool_t * pool, f_str_t * input, GTree ** tree, +osb_tokenize_text (struct tokenizer *tokenizer, rspamd_mempool_t * pool, f_str_t * input, GTree ** tree, gboolean save_token, gboolean is_utf, GList *exceptions) { token_node_t *new = NULL; @@ -46,7 +46,7 @@ osb_tokenize_text (struct tokenizer *tokenizer, memory_pool_t * pool, f_str_t * if (*tree == NULL) { *tree = g_tree_new (token_node_compare_func); - memory_pool_add_destructor (pool, (pool_destruct_func) g_tree_destroy, *tree); + rspamd_mempool_add_destructor (pool, (rspamd_mempool_destruct_t) g_tree_destroy, *tree); } memset (hashpipe, 0xfe, FEATURE_WINDOW_SIZE * sizeof (hashpipe[0])); @@ -80,11 +80,11 @@ osb_tokenize_text (struct tokenizer *tokenizer, memory_pool_t * pool, f_str_t * for (i = 1; i < FEATURE_WINDOW_SIZE; i++) { h1 = hashpipe[0] * primes[0] + hashpipe[i] * primes[i << 1]; h2 = hashpipe[0] * primes[1] + hashpipe[i] * primes[(i << 1) - 1]; - new = memory_pool_alloc0 (pool, sizeof (token_node_t)); + new = rspamd_mempool_alloc0 (pool, sizeof (token_node_t)); new->h1 = h1; new->h2 = h2; if (save_token) { - new->extra = (uintptr_t)memory_pool_fstrdup (pool, &token); + new->extra = (uintptr_t)rspamd_mempool_fstrdup (pool, &token); } if (g_tree_lookup (*tree, new) == NULL) { @@ -99,11 +99,11 @@ osb_tokenize_text (struct tokenizer *tokenizer, memory_pool_t * pool, f_str_t * for (i = 1; i < processed; i++) { h1 = hashpipe[0] * primes[0] + hashpipe[i] * primes[i << 1]; h2 = hashpipe[0] * primes[1] + hashpipe[i] * primes[(i << 1) - 1]; - new = memory_pool_alloc0 (pool, sizeof (token_node_t)); + new = rspamd_mempool_alloc0 (pool, sizeof (token_node_t)); new->h1 = h1; new->h2 = h2; if (save_token) { - new->extra = (uintptr_t)memory_pool_fstrdup (pool, &token); + new->extra = (uintptr_t)rspamd_mempool_fstrdup (pool, &token); } if (g_tree_lookup (*tree, new) == NULL) { diff --git a/src/tokenizers/tokenizers.c b/src/tokenizers/tokenizers.c index 43dcfac82..0cdd0aaf4 100644 --- a/src/tokenizers/tokenizers.c +++ b/src/tokenizers/tokenizers.c @@ -189,7 +189,7 @@ typedef struct _GMimeHeader { } local_GMimeHeader; int -tokenize_headers (memory_pool_t * pool, struct worker_task *task, GTree ** tree) +tokenize_headers (rspamd_mempool_t * pool, struct worker_task *task, GTree ** tree) { token_node_t *new = NULL; f_str_t headername; @@ -197,7 +197,7 @@ tokenize_headers (memory_pool_t * pool, struct worker_task *task, GTree ** tree) if (*tree == NULL) { *tree = g_tree_new (token_node_compare_func); - memory_pool_add_destructor (pool, (pool_destruct_func) g_tree_destroy, *tree); + rspamd_mempool_add_destructor (pool, (rspamd_mempool_destruct_t) g_tree_destroy, *tree); } #ifndef GMIME24 struct raw_header *h; @@ -205,7 +205,7 @@ tokenize_headers (memory_pool_t * pool, struct worker_task *task, GTree ** tree) h = GMIME_OBJECT (task->message)->headers->headers; while (h) { if (h->name && h->value) { - new = memory_pool_alloc (pool, sizeof (token_node_t)); + new = rspamd_mempool_alloc (pool, sizeof (token_node_t)); headername.begin = h->name; headername.len = strlen (h->name); headervalue.begin = h->value; @@ -229,7 +229,7 @@ tokenize_headers (memory_pool_t * pool, struct worker_task *task, GTree ** tree) if (g_mime_header_list_get_iter (ls, iter)) { while (g_mime_header_iter_is_valid (iter)) { - new = memory_pool_alloc (pool, sizeof (token_node_t)); + new = rspamd_mempool_alloc (pool, sizeof (token_node_t)); name = g_mime_header_iter_get_name (iter); value = g_mime_header_iter_get_value (iter); headername.begin = (u_char *)name; @@ -260,7 +260,7 @@ tokenize_subject (struct worker_task *task, GTree ** tree) if (*tree == NULL) { *tree = g_tree_new (token_node_compare_func); - memory_pool_add_destructor (task->task_pool, (pool_destruct_func) g_tree_destroy, *tree); + rspamd_mempool_add_destructor (task->task_pool, (rspamd_mempool_destruct_t) g_tree_destroy, *tree); } osb_tokenizer = get_tokenizer ("osb-text"); diff --git a/src/tokenizers/tokenizers.h b/src/tokenizers/tokenizers.h index f2e8c9a4f..0a8d27d57 100644 --- a/src/tokenizers/tokenizers.h +++ b/src/tokenizers/tokenizers.h @@ -19,7 +19,7 @@ typedef struct token_node_s { /* Common tokenizer structure */ struct tokenizer { gchar *name; - gint (*tokenize_func)(struct tokenizer *tokenizer, memory_pool_t *pool, f_str_t *input, + gint (*tokenize_func)(struct tokenizer *tokenizer, rspamd_mempool_t *pool, f_str_t *input, GTree **cur, gboolean save_token, gboolean is_utf, GList *exceptions); gchar* (*get_next_word)(f_str_t *buf, f_str_t *token, GList **exceptions); }; @@ -31,10 +31,10 @@ struct tokenizer* get_tokenizer (const char *name); /* Get next word from specified f_str_t buf */ gchar* get_next_word (f_str_t *buf, f_str_t *token, GList **exceptions); /* OSB tokenize function */ -int osb_tokenize_text (struct tokenizer *tokenizer, memory_pool_t *pool, f_str_t *input, +int osb_tokenize_text (struct tokenizer *tokenizer, rspamd_mempool_t *pool, f_str_t *input, GTree **cur, gboolean save_token, gboolean is_utf, GList *exceptions); /* Common tokenizer for headers */ -int tokenize_headers (memory_pool_t *pool, struct worker_task *task, GTree **cur); +int tokenize_headers (rspamd_mempool_t *pool, struct worker_task *task, GTree **cur); /* Make tokens for a subject */ void tokenize_subject (struct worker_task *task, GTree ** tree); -- cgit v1.2.3