diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-26 15:41:25 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-26 15:41:25 +0400 |
commit | b90453e65ae072c0de6e3ec748a0f41ebb17e0ca (patch) | |
tree | 5a7d1f66c4367efa9152e23fc2999f61e4bf4934 /src | |
parent | 33f9a2a6f1c799f3f51c065485dfa1761053e88b (diff) | |
download | rspamd-b90453e65ae072c0de6e3ec748a0f41ebb17e0ca.tar.gz rspamd-b90453e65ae072c0de6e3ec748a0f41ebb17e0ca.zip |
Move hash table creation to the proper place.
Diffstat (limited to 'src')
-rw-r--r-- | src/symbols_cache.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/symbols_cache.c b/src/symbols_cache.c index 3684bd5e5..d5a129459 100644 --- a/src/symbols_cache.c +++ b/src/symbols_cache.c @@ -120,14 +120,12 @@ post_cache_init (struct symbols_cache *cache) while (cur) { item = cur->data; total_frequency += item->s->frequency; - g_hash_table_insert (cache->items_by_symbol, item->s->symbol, item); cur = g_list_next (cur); } cur = g_list_first (cache->static_items); while (cur) { item = cur->data; total_frequency += item->s->frequency; - g_hash_table_insert (cache->items_by_symbol, item->s->symbol, item); cur = g_list_next (cur); } @@ -271,6 +269,7 @@ register_symbol_common (struct symbols_cache **cache, const gchar *name, double pcache = g_new0 (struct symbols_cache, 1); *cache = pcache; pcache->static_pool = memory_pool_new (memory_pool_get_size ()); + pcache->items_by_symbol = g_hash_table_new (g_str_hash, g_str_equal); } item = memory_pool_alloc0 (pcache->static_pool, sizeof (struct cache_item)); @@ -319,6 +318,7 @@ register_symbol_common (struct symbols_cache **cache, const gchar *name, double } pcache->used_items++; + g_hash_table_insert (pcache->items_by_symbol, item->s->symbol, item); msg_debug ("used items: %d, added symbol: %s", (*cache)->used_items, name); set_counter (item->s->symbol, 0); @@ -622,7 +622,6 @@ init_symbols_cache (memory_pool_t * pool, struct symbols_cache *cache, struct co } /* MMap cache file and copy saved_cache structures */ res = mmap_cache_file (cache, fd, pool); - cache->items_by_symbol = g_hash_table_new (g_str_hash, g_str_equal); memory_pool_add_destructor (pool, (pool_destruct_func)free_cache, cache); |