]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix broken types casts in backends.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 20 Jun 2015 20:58:11 +0000 (21:58 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 20 Jun 2015 20:58:11 +0000 (21:58 +0100)
src/libstat/backends/backends.h
src/libstat/backends/mmaped_file.c
src/libstat/backends/redis.c
src/libstat/backends/sqlite3_backend.c

index 18f4fce266296020cda4ed56344d21bfed83aaf2..f970a297b794c5a28137ea7c622567a0f298e5e6 100644 (file)
@@ -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)
 
index 20bce62128139bd2e446ca1cdae857351d4734f5..7c12e092d16819be0ed2ff30274b432f9e80a3c4 100644 (file)
@@ -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;
index deb2ea84dbfd7af20fe6e2b3577bc70834db1068..9d2f05eeaa8067dbb9072db4558c908511a18c1f 100644 (file)
@@ -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);
index 21b5918acbb8d27c578df94a4b4785230161ee40..30d887831ef40d8c2c192042aa425ebd44caafde 100644 (file)
@@ -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;