aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-18 15:15:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-18 15:15:15 +0100
commit1fa986698913636816f9259059cebaae3ef25520 (patch)
treeeb24dda3b9052f6fae58f87b30ba6d0bb7b25e9d /src/libstat
parent10d95e5e59fec5cc39acb533413d9e72a39456e4 (diff)
downloadrspamd-1fa986698913636816f9259059cebaae3ef25520.tar.gz
rspamd-1fa986698913636816f9259059cebaae3ef25520.zip
Simplify declaring of backends.
Diffstat (limited to 'src/libstat')
-rw-r--r--src/libstat/stat_config.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c
index 8c935ec4e..91cca76c7 100644
--- a/src/libstat/stat_config.c
+++ b/src/libstat/stat_config.c
@@ -55,19 +55,22 @@ static struct rspamd_stat_tokenizer stat_tokenizers[] = {
},
};
-static struct rspamd_stat_backend stat_backends[] = {
- {
- .name = RSPAMD_DEFAULT_BACKEND,
- .init = rspamd_mmaped_file_init,
- .runtime = rspamd_mmaped_file_runtime,
- .process_token = rspamd_mmaped_file_process_token,
- .learn_token = rspamd_mmaped_file_learn_token,
- .finalize_learn = rspamd_mmaped_file_finalize_learn,
- .total_learns = rspamd_mmaped_file_total_learns,
- .inc_learns = rspamd_mmaped_file_inc_learns,
- .dec_learns = rspamd_mmaped_file_dec_learns,
- .get_stat = rspamd_mmaped_file_get_stat
+#define RSPAMD_STAT_BACKEND_ELT(nam, eltn) { \
+ .name = #nam, \
+ .init = rspamd_##eltn##_init, \
+ .runtime = rspamd_##eltn##_runtime, \
+ .process_token = rspamd_##eltn##_process_token, \
+ .learn_token = rspamd_##eltn##_learn_token, \
+ .finalize_learn = rspamd_##eltn##_finalize_learn, \
+ .total_learns = rspamd_##eltn##_total_learns, \
+ .inc_learns = rspamd_##eltn##_inc_learns, \
+ .dec_learns = rspamd_##eltn##_dec_learns, \
+ .get_stat = rspamd_##eltn##_get_stat \
}
+
+static struct rspamd_stat_backend stat_backends[] = {
+ RSPAMD_STAT_BACKEND_ELT(mmap, mmaped_file),
+ RSPAMD_STAT_BACKEND_ELT(sqlite3, sqlite3)
};
static struct rspamd_stat_cache stat_caches[] = {