aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-20 21:58:11 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-20 21:58:11 +0100
commit40bc3781bdd94d82ee31c7c23f88e703275bfaac (patch)
tree7a758aeb82fa8d0a78540a9fbc1867c6a036d2fd /src/libstat/backends
parent29c56c31b68a3c55a0b77689b7a3ee141549e485 (diff)
downloadrspamd-40bc3781bdd94d82ee31c7c23f88e703275bfaac.tar.gz
rspamd-40bc3781bdd94d82ee31c7c23f88e703275bfaac.zip
Fix broken types casts in backends.
Diffstat (limited to 'src/libstat/backends')
-rw-r--r--src/libstat/backends/backends.h12
-rw-r--r--src/libstat/backends/mmaped_file.c10
-rw-r--r--src/libstat/backends/redis.c17
-rw-r--r--src/libstat/backends/sqlite3_backend.c38
4 files changed, 27 insertions, 50 deletions
diff --git a/src/libstat/backends/backends.h b/src/libstat/backends/backends.h
index 18f4fce26..f970a297b 100644
--- a/src/libstat/backends/backends.h
+++ b/src/libstat/backends/backends.h
@@ -69,17 +69,17 @@ struct rspamd_stat_backend {
gboolean rspamd_##name##_learn_token (struct token_node_s *tok, \
struct rspamd_token_result *res, \
gpointer ctx); \
- void rspamd_##name##_finalize_learn (struct rspamd_statfile_runtime *runtime, \
+ void rspamd_##name##_finalize_learn (gpointer runtime, \
gpointer ctx); \
- gulong rspamd_##name##_total_learns (struct rspamd_statfile_runtime *runtime, \
+ gulong rspamd_##name##_total_learns (gpointer runtime, \
gpointer ctx); \
- gulong rspamd_##name##_inc_learns (struct rspamd_statfile_runtime *runtime, \
+ gulong rspamd_##name##_inc_learns (gpointer runtime, \
gpointer ctx); \
- gulong rspamd_##name##_dec_learns (struct rspamd_statfile_runtime *runtime, \
+ gulong rspamd_##name##_dec_learns (gpointer runtime, \
gpointer ctx); \
- gulong rspamd_##name##_learns (struct rspamd_statfile_runtime *runtime, \
+ gulong rspamd_##name##_learns (gpointer runtime, \
gpointer ctx); \
- ucl_object_t * rspamd_##name##_get_stat (struct rspamd_statfile_runtime *runtime, \
+ ucl_object_t * rspamd_##name##_get_stat (gpointer runtime, \
gpointer ctx); \
void rspamd_##name##_close (gpointer ctx)
diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c
index 20bce6212..7c12e092d 100644
--- a/src/libstat/backends/mmaped_file.c
+++ b/src/libstat/backends/mmaped_file.c
@@ -1001,7 +1001,7 @@ rspamd_mmaped_file_learn_token (rspamd_token_t *tok,
}
gulong
-rspamd_mmaped_file_total_learns (struct rspamd_statfile_runtime *runtime,
+rspamd_mmaped_file_total_learns (gpointer runtime,
gpointer ctx)
{
rspamd_mmaped_file_t *mf = (rspamd_mmaped_file_t *)runtime;
@@ -1016,7 +1016,7 @@ rspamd_mmaped_file_total_learns (struct rspamd_statfile_runtime *runtime,
}
gulong
-rspamd_mmaped_file_inc_learns (struct rspamd_statfile_runtime *runtime,
+rspamd_mmaped_file_inc_learns (gpointer runtime,
gpointer ctx)
{
rspamd_mmaped_file_t *mf = (rspamd_mmaped_file_t *)runtime;
@@ -1032,7 +1032,7 @@ rspamd_mmaped_file_inc_learns (struct rspamd_statfile_runtime *runtime,
}
gulong
-rspamd_mmaped_file_dec_learns (struct rspamd_statfile_runtime *runtime,
+rspamd_mmaped_file_dec_learns (gpointer runtime,
gpointer ctx)
{
rspamd_mmaped_file_t *mf = (rspamd_mmaped_file_t *)runtime;
@@ -1049,7 +1049,7 @@ rspamd_mmaped_file_dec_learns (struct rspamd_statfile_runtime *runtime,
ucl_object_t *
-rspamd_mmaped_file_get_stat (struct rspamd_statfile_runtime *runtime,
+rspamd_mmaped_file_get_stat (gpointer runtime,
gpointer ctx)
{
ucl_object_t *res = NULL;
@@ -1080,7 +1080,7 @@ rspamd_mmaped_file_get_stat (struct rspamd_statfile_runtime *runtime,
}
void
-rspamd_mmaped_file_finalize_learn (struct rspamd_statfile_runtime *runtime,
+rspamd_mmaped_file_finalize_learn (gpointer runtime,
gpointer ctx)
{
rspamd_mmaped_file_t *mf = (rspamd_mmaped_file_t *)runtime;
diff --git a/src/libstat/backends/redis.c b/src/libstat/backends/redis.c
index deb2ea84d..9d2f05eea 100644
--- a/src/libstat/backends/redis.c
+++ b/src/libstat/backends/redis.c
@@ -422,20 +422,3 @@ rspamd_redis_runtime (struct rspamd_task *task,
return rt;
}
-
-gboolean rspamd_redis_process_token (struct token_node_s *tok,
- struct rspamd_token_result *res,
- gpointer ctx);
-gboolean rspamd_redis_learn_token (struct token_node_s *tok,
- struct rspamd_token_result *res,
- gpointer ctx);
-void rspamd_redis_finalize_learn (struct rspamd_statfile_runtime *runtime,
- gpointer ctx);
-gulong rspamd_redis_total_learns (struct rspamd_statfile_runtime *runtime,
- gpointer ctx);
-gulong rspamd_redis_inc_learns (struct rspamd_statfile_runtime *runtime,
- gpointer ctx);
-gulong rspamd_redis_learns (struct rspamd_statfile_runtime *runtime,
- gpointer ctx);
-ucl_object_t * rspamd_redis_get_stat (struct rspamd_statfile_runtime *runtime,
- gpointer ctx);
diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c
index 21b5918ac..30d887831 100644
--- a/src/libstat/backends/sqlite3_backend.c
+++ b/src/libstat/backends/sqlite3_backend.c
@@ -509,13 +509,12 @@ rspamd_sqlite3_learn_token (struct token_node_s *tok,
}
void
-rspamd_sqlite3_finalize_learn (struct rspamd_statfile_runtime *runtime,
+rspamd_sqlite3_finalize_learn (gpointer runtime,
gpointer ctx)
{
- struct rspamd_stat_sqlite3_db *bk;
+ struct rspamd_stat_sqlite3_db *bk = runtime;
- g_assert (runtime->backend_runtime != NULL);
- bk = runtime->backend_runtime;
+ g_assert (bk != NULL);
if (bk->in_transaction) {
rspamd_sqlite3_run_prstmt (bk, RSPAMD_STAT_BACKEND_TRANSACTION_COMMIT);
@@ -526,14 +525,13 @@ rspamd_sqlite3_finalize_learn (struct rspamd_statfile_runtime *runtime,
}
gulong
-rspamd_sqlite3_total_learns (struct rspamd_statfile_runtime *runtime,
+rspamd_sqlite3_total_learns (gpointer runtime,
gpointer ctx)
{
- struct rspamd_stat_sqlite3_db *bk;
+ struct rspamd_stat_sqlite3_db *bk = runtime;
guint64 res;
- g_assert (runtime->backend_runtime != NULL);
- bk = runtime->backend_runtime;
+ g_assert (bk != NULL);
rspamd_sqlite3_run_prstmt (bk, RSPAMD_STAT_BACKEND_GET_LEARNS, &res);
@@ -541,13 +539,12 @@ rspamd_sqlite3_total_learns (struct rspamd_statfile_runtime *runtime,
}
gulong
-rspamd_sqlite3_inc_learns (struct rspamd_statfile_runtime *runtime,
+rspamd_sqlite3_inc_learns (gpointer runtime,
gpointer ctx)
{
- struct rspamd_stat_sqlite3_db *bk;
+ struct rspamd_stat_sqlite3_db *bk = runtime;
- g_assert (runtime->backend_runtime != NULL);
- bk = runtime->backend_runtime;
+ g_assert (bk != NULL);
rspamd_sqlite3_run_prstmt (bk, RSPAMD_STAT_BACKEND_INC_LEARNS,
SQLITE3_DEFAULT, SQLITE3_DEFAULT);
@@ -555,13 +552,12 @@ rspamd_sqlite3_inc_learns (struct rspamd_statfile_runtime *runtime,
}
gulong
-rspamd_sqlite3_dec_learns (struct rspamd_statfile_runtime *runtime,
+rspamd_sqlite3_dec_learns (gpointer runtime,
gpointer ctx)
{
- struct rspamd_stat_sqlite3_db *bk;
+ struct rspamd_stat_sqlite3_db *bk = runtime;
- g_assert (runtime->backend_runtime != NULL);
- bk = runtime->backend_runtime;
+ g_assert (bk != NULL);
rspamd_sqlite3_run_prstmt (bk, RSPAMD_STAT_BACKEND_DEC_LEARNS,
SQLITE3_DEFAULT, SQLITE3_DEFAULT);
@@ -569,22 +565,20 @@ rspamd_sqlite3_dec_learns (struct rspamd_statfile_runtime *runtime,
}
gulong
-rspamd_sqlite3_learns (struct rspamd_statfile_runtime *runtime,
+rspamd_sqlite3_learns (gpointer runtime,
gpointer ctx)
{
- struct rspamd_stat_sqlite3_db *bk;
+ struct rspamd_stat_sqlite3_db *bk = runtime;
guint64 res;
- g_assert (runtime->backend_runtime != NULL);
- bk = runtime->backend_runtime;
-
+ g_assert (bk);
rspamd_sqlite3_run_prstmt (bk, RSPAMD_STAT_BACKEND_GET_LEARNS, &res);
return res;
}
ucl_object_t *
-rspamd_sqlite3_get_stat (struct rspamd_statfile_runtime *runtime,
+rspamd_sqlite3_get_stat (gpointer runtime,
gpointer ctx)
{
return NULL;