aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-10-06 20:03:57 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-10-06 20:03:57 +0400
commit6b306ab8752befc28d259be55495f8249cc2df24 (patch)
tree0fa3d471aef61925563709e0f8ee5667b57c7a9d /src/lua
parent8d0053734fb5a4ccd8c3bda731e6b7c8261c6f67 (diff)
downloadrspamd-6b306ab8752befc28d259be55495f8249cc2df24.tar.gz
rspamd-6b306ab8752befc28d259be55495f8249cc2df24.zip
Fixes types (use glib ones) no functional change.
Now all comments in commit logs beginning with '*' would be included in changelog, so important changes would be separated from small ones.
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_cfg_file.c6
-rw-r--r--src/lua/lua_classifier.c18
-rw-r--r--src/lua/lua_common.c56
-rw-r--r--src/lua/lua_common.h44
-rw-r--r--src/lua/lua_config.c68
-rw-r--r--src/lua/lua_message.c20
-rw-r--r--src/lua/lua_task.c116
7 files changed, 164 insertions, 164 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index 799a603c0..b67466d7b 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -68,7 +68,7 @@ lua_process_module (lua_State *L, const gchar *param, struct config_file *cfg)
{
GList *cur_opt;
struct module_opt *cur;
- const char *name;
+ const gchar *name;
gboolean new_module = FALSE;
/* Get module opt structure */
@@ -95,10 +95,10 @@ lua_process_module (lua_State *L, const gchar *param, struct config_file *cfg)
/* Process single element */
void
-lua_process_element (struct config_file *cfg, const char *name, struct module_opt *opt, int idx)
+lua_process_element (struct config_file *cfg, const gchar *name, struct module_opt *opt, gint idx)
{
lua_State *L = cfg->lua_state;
- int t;
+ gint t;
double *num;
gboolean *flag;
diff --git a/src/lua/lua_classifier.c b/src/lua/lua_classifier.c
index 86378c5e5..f7ce173a7 100644
--- a/src/lua/lua_classifier.c
+++ b/src/lua/lua_classifier.c
@@ -48,7 +48,7 @@ static const struct luaL_reg statfilelib_m[] = {
struct classifier_callback_data {
lua_State *L;
- const char *name;
+ const gchar *name;
};
static struct statfile* lua_check_statfile (lua_State * L);
@@ -73,7 +73,7 @@ call_classifier_pre_callbacks (struct classifier_config *ccf, struct worker_task
struct classifier_config **pccf;
struct worker_task **ptask;
struct statfile *st;
- int i, len;
+ gint i, len;
/* Go throught all callbacks and call them, appending results to list */
cur = g_list_first (ccf->pre_callbacks);
@@ -153,12 +153,12 @@ call_classifier_post_callbacks (struct classifier_config *ccf, struct worker_tas
}
-static int
+static gint
lua_classifier_register_pre_callback (lua_State *L)
{
struct classifier_config *ccf = lua_check_classifier (L);
struct classifier_callback_data *cd;
- const char *name;
+ const gchar *name;
if (ccf) {
name = luaL_checkstring (L, 2);
@@ -174,12 +174,12 @@ lua_classifier_register_pre_callback (lua_State *L)
}
-static int
+static gint
lua_classifier_register_post_callback (lua_State *L)
{
struct classifier_config *ccf = lua_check_classifier (L);
struct classifier_callback_data *cd;
- const char *name;
+ const gchar *name;
if (ccf) {
name = luaL_checkstring (L, 2);
@@ -195,7 +195,7 @@ lua_classifier_register_post_callback (lua_State *L)
}
/* Return table of statfiles indexed by theirs name */
-static int
+static gint
lua_classifier_get_statfiles (lua_State *L)
{
struct classifier_config *ccf = lua_check_classifier (L);
@@ -237,7 +237,7 @@ lua_check_statfile (lua_State * L)
/* Open functions */
-int
+gint
luaopen_classifier (lua_State * L)
{
lua_newclass (L, "rspamd{classifier}", classifierlib_m);
@@ -246,7 +246,7 @@ luaopen_classifier (lua_State * L)
return 1;
}
-int
+gint
luaopen_statfile (lua_State * L)
{
lua_newclass (L, "rspamd{statfile}", statfilelib_m);
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index adf26e686..38111ea38 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -50,7 +50,7 @@ static const struct luaL_reg loggerlib_m[] = {
/* Util functions */
void
-lua_newclass (lua_State * L, const char *classname, const struct luaL_reg *func)
+lua_newclass (lua_State * L, const gchar *classname, const struct luaL_reg *func)
{
luaL_newmetatable (L, classname); /* mt */
lua_pushstring (L, "__index");
@@ -64,10 +64,10 @@ lua_newclass (lua_State * L, const char *classname, const struct luaL_reg *func)
luaL_openlib (L, NULL, func, 0);
}
-int
+gint
lua_class_tostring (lua_State * L)
{
- char buf[32];
+ gchar buf[32];
if (!lua_getmetatable (L, 1)) {
goto error;
@@ -99,7 +99,7 @@ lua_class_tostring (lua_State * L)
void
-lua_setclass (lua_State * L, const char *classname, int objidx)
+lua_setclass (lua_State * L, const gchar *classname, gint objidx)
{
luaL_getmetatable (L, classname);
if (objidx < 0) {
@@ -110,7 +110,7 @@ lua_setclass (lua_State * L, const char *classname, int objidx)
/* assume that table is at the top */
void
-lua_set_table_index (lua_State * L, const char *index, const char *value)
+lua_set_table_index (lua_State * L, const gchar *index, const gchar *value)
{
lua_pushstring (L, index);
@@ -119,10 +119,10 @@ lua_set_table_index (lua_State * L, const char *index, const char *value)
}
static void
-lua_common_log (GLogLevelFlags level, lua_State *L, const char *msg)
+lua_common_log (GLogLevelFlags level, lua_State *L, const gchar *msg)
{
lua_Debug d;
- char func_buf[128], *p;
+ gchar func_buf[128], *p;
if (lua_getstack (L, 1, &d) == 1) {
(void)lua_getinfo(L, "Sl", &d);
@@ -151,37 +151,37 @@ lua_common_log (GLogLevelFlags level, lua_State *L, const char *msg)
}
/*** Logger interface ***/
-static int
+static gint
lua_logger_err (lua_State * L)
{
- const char *msg;
+ const gchar *msg;
msg = luaL_checkstring (L, 2);
lua_common_log (G_LOG_LEVEL_CRITICAL, L, msg);
return 1;
}
-static int
+static gint
lua_logger_warn (lua_State * L)
{
- const char *msg;
+ const gchar *msg;
msg = luaL_checkstring (L, 2);
lua_common_log (G_LOG_LEVEL_WARNING, L, msg);
return 1;
}
-static int
+static gint
lua_logger_info (lua_State * L)
{
- const char *msg;
+ const gchar *msg;
msg = luaL_checkstring (L, 2);
lua_common_log (G_LOG_LEVEL_INFO, L, msg);
return 1;
}
-static int
+static gint
lua_logger_debug (lua_State * L)
{
- const char *msg;
+ const gchar *msg;
msg = luaL_checkstring (L, 2);
lua_common_log (G_LOG_LEVEL_DEBUG, L, msg);
return 1;
@@ -190,7 +190,7 @@ lua_logger_debug (lua_State * L)
/*** Init functions ***/
-int
+gint
luaopen_rspamd (lua_State * L)
{
luaL_openlib (L, "rspamd", null_reg, 0);
@@ -202,7 +202,7 @@ luaopen_rspamd (lua_State * L)
return 1;
}
-int
+gint
luaopen_logger (lua_State * L)
{
@@ -304,10 +304,10 @@ init_lua_filters (struct config_file *cfg)
/* Callback functions */
-int
-lua_call_filter (const char *function, struct worker_task *task)
+gint
+lua_call_filter (const gchar *function, struct worker_task *task)
{
- int result;
+ gint result;
struct worker_task **ptask;
lua_State *L = task->cfg->lua_state;
@@ -329,10 +329,10 @@ lua_call_filter (const char *function, struct worker_task *task)
return result;
}
-int
-lua_call_chain_filter (const char *function, struct worker_task *task, int *marks, unsigned int number)
+gint
+lua_call_chain_filter (const gchar *function, struct worker_task *task, gint *marks, guint number)
{
- int result, i;
+ gint result, i;
lua_State *L = task->cfg->lua_state;
lua_getglobal (L, function);
@@ -355,13 +355,13 @@ lua_call_chain_filter (const char *function, struct worker_task *task, int *mark
/* Call custom lua function in rspamd expression */
gboolean
-lua_call_expression_func (const char *function, struct worker_task *task, GList *args, gboolean *res)
+lua_call_expression_func (const gchar *function, struct worker_task *task, GList *args, gboolean *res)
{
lua_State *L = task->cfg->lua_state;
struct worker_task **ptask;
GList *cur;
struct expression_argument *arg;
- int nargs = 0;
+ gint nargs = 0;
lua_getglobal (L, function);
ptask = lua_newuserdata (L, sizeof (struct worker_task *));
@@ -409,7 +409,7 @@ lua_call_expression_func (const char *function, struct worker_task *task, GList
struct consolidation_callback_data {
struct worker_task *task;
double score;
- const char *func;
+ const gchar *func;
};
static void
@@ -422,7 +422,7 @@ lua_consolidation_callback (gpointer key, gpointer value, gpointer arg)
lua_getglobal (L, data->func);
- lua_pushstring (L, (const char *)key);
+ lua_pushstring (L, (const gchar *)key);
lua_pushnumber (L, s->score);
if (lua_pcall (L, 2, 1, 0) != 0) {
msg_info ("call to %s failed", data->func);
@@ -438,7 +438,7 @@ lua_consolidation_callback (gpointer key, gpointer value, gpointer arg)
}
double
-lua_consolidation_func (struct worker_task *task, const char *metric_name, const char *function_name)
+lua_consolidation_func (struct worker_task *task, const gchar *metric_name, const gchar *function_name)
{
struct metric_result *metric_res;
double res = 0.;
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index 105fb7ca2..ede42562a 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -11,37 +11,37 @@
#include <lualib.h>
/* Interface definitions */
-#define LUA_FUNCTION_DEF(class, name) static int lua_##class##_##name(lua_State *L)
+#define LUA_FUNCTION_DEF(class, name) static gint lua_##class##_##name(lua_State *L)
#define LUA_INTERFACE_DEF(class, name) { #name, lua_##class##_##name }
extern const luaL_reg null_reg[];
/* Common utility functions */
-void lua_newclass (lua_State *L, const char *classname, const struct luaL_reg *func);
-void lua_setclass (lua_State *L, const char *classname, int objidx);
-void lua_set_table_index (lua_State *L, const char *index, const char *value);
-int lua_class_tostring (lua_State *L);
-int luaopen_message (lua_State *L);
-int luaopen_task (lua_State *L);
-int luaopen_config (lua_State *L);
-int luaopen_metric (lua_State *L);
-int luaopen_radix (lua_State *L);
-int luaopen_hash_table (lua_State *L);
-int luaopen_trie (lua_State * L);
-int luaopen_textpart (lua_State *L);
-int luaopen_image (lua_State *L);
-int luaopen_classifier (lua_State *L);
-int luaopen_statfile (lua_State * L);
+void lua_newclass (lua_State *L, const gchar *classname, const struct luaL_reg *func);
+void lua_setclass (lua_State *L, const gchar *classname, gint objidx);
+void lua_set_table_index (lua_State *L, const gchar *index, const gchar *value);
+gint lua_class_tostring (lua_State *L);
+gint luaopen_message (lua_State *L);
+gint luaopen_task (lua_State *L);
+gint luaopen_config (lua_State *L);
+gint luaopen_metric (lua_State *L);
+gint luaopen_radix (lua_State *L);
+gint luaopen_hash_table (lua_State *L);
+gint luaopen_trie (lua_State * L);
+gint luaopen_textpart (lua_State *L);
+gint luaopen_image (lua_State *L);
+gint luaopen_classifier (lua_State *L);
+gint luaopen_statfile (lua_State * L);
void init_lua (struct config_file *cfg);
gboolean init_lua_filters (struct config_file *cfg);
/* Filters functions */
-int lua_call_filter (const char *function, struct worker_task *task);
-int lua_call_chain_filter (const char *function, struct worker_task *task, int *marks, unsigned int number);
-double lua_consolidation_func (struct worker_task *task, const char *metric_name, const char *function_name);
-gboolean lua_call_expression_func (const char *function, struct worker_task *task, GList *args, gboolean *res);
+gint lua_call_filter (const gchar *function, struct worker_task *task);
+gint lua_call_chain_filter (const gchar *function, struct worker_task *task, gint *marks, guint number);
+double lua_consolidation_func (struct worker_task *task, const gchar *metric_name, const gchar *function_name);
+gboolean lua_call_expression_func (const gchar *function, struct worker_task *task, GList *args, gboolean *res);
void lua_call_post_filters (struct worker_task *task);
-void add_luabuf (const char *line);
+void add_luabuf (const gchar *line);
/* Classify functions */
GList *call_classifier_pre_callbacks (struct classifier_config *ccf, struct worker_task *task);
@@ -51,7 +51,7 @@ double lua_normalizer_func (struct config_file *cfg, long double score, void *pa
/* Config file functions */
void lua_post_load_config (struct config_file *cfg);
-void lua_process_element (struct config_file *cfg, const char *name, struct module_opt *opt, int idx);
+void lua_process_element (struct config_file *cfg, const gchar *name, struct module_opt *opt, gint idx);
gboolean lua_handle_param (struct worker_task *task, gchar *mname, gchar *optname,
enum lua_var_type expected_type, gpointer *res);
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index a247bbbf7..92eaf0b20 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -121,18 +121,18 @@ lua_check_trie (lua_State * L)
}
/*** Config functions ***/
-static int
+static gint
lua_config_get_module_opt (lua_State * L)
{
struct config_file *cfg = lua_check_config (L);
- const char *mname, *optname, *val;
+ const gchar *mname, *optname, *val;
if (cfg) {
mname = luaL_checkstring (L, 2);
optname = luaL_checkstring (L, 3);
if (mname && optname) {
- val = get_module_opt (cfg, (char *)mname, (char *)optname);
+ val = get_module_opt (cfg, (gchar *)mname, (gchar *)optname);
if (val) {
lua_pushstring (L, val);
return 1;
@@ -143,7 +143,7 @@ lua_config_get_module_opt (lua_State * L)
return 1;
}
-static int
+static gint
opt_compare (gconstpointer a, gconstpointer b)
{
const struct module_opt *o1 = a,
@@ -152,14 +152,14 @@ opt_compare (gconstpointer a, gconstpointer b)
return g_ascii_strcasecmp (o1->param, o2->param);
}
-static int
+static gint
lua_config_get_all_opt (lua_State * L)
{
struct config_file *cfg = lua_check_config (L);
- const char *mname;
+ const gchar *mname;
GList *cur_opt, *next_opt;
struct module_opt *opt, *tmp;
- int i;
+ gint i;
if (cfg) {
mname = luaL_checkstring (L, 2);
@@ -227,12 +227,12 @@ lua_config_get_all_opt (lua_State * L)
}
-static int
+static gint
lua_config_get_classifier (lua_State * L)
{
struct config_file *cfg = lua_check_config (L);
struct classifier_config *clc = NULL, **pclc = NULL;
- const char *name;
+ const gchar *name;
GList *cur;
if (cfg) {
@@ -261,7 +261,7 @@ lua_config_get_classifier (lua_State * L)
}
struct lua_callback_data {
- const char *name;
+ const gchar *name;
lua_State *L;
};
@@ -270,7 +270,7 @@ lua_config_function_callback (struct worker_task *task, GList *args, void *user_
{
struct lua_callback_data *cd = user_data;
struct worker_task **ptask;
- int i = 1;
+ gint i = 1;
struct expression_argument *arg;
GList *cur;
gboolean res = FALSE;
@@ -283,7 +283,7 @@ lua_config_function_callback (struct worker_task *task, GList *args, void *user_
cur = args;
while (cur) {
arg = get_function_arg (cur->data, task, TRUE);
- lua_pushstring (cd->L, (const char *)arg->data);
+ lua_pushstring (cd->L, (const gchar *)arg->data);
cur = g_list_next (cur);
i ++;
}
@@ -300,11 +300,11 @@ lua_config_function_callback (struct worker_task *task, GList *args, void *user_
return res;
}
-static int
+static gint
lua_config_register_function (lua_State *L)
{
struct config_file *cfg = lua_check_config (L);
- const char *name, *callback;
+ const gchar *name, *callback;
struct lua_callback_data *cd;
if (cfg) {
@@ -343,11 +343,11 @@ lua_call_post_filters (struct worker_task *task)
}
}
-static int
+static gint
lua_config_register_post_filter (lua_State *L)
{
struct config_file *cfg = lua_check_config (L);
- const char *callback;
+ const gchar *callback;
struct lua_callback_data *cd;
if (cfg) {
@@ -363,11 +363,11 @@ lua_config_register_post_filter (lua_State *L)
return 1;
}
-static int
+static gint
lua_config_add_radix_map (lua_State *L)
{
struct config_file *cfg = lua_check_config (L);
- const char *map_line;
+ const gchar *map_line;
radix_tree_t **r, ***ud;
if (cfg) {
@@ -393,11 +393,11 @@ lua_config_add_radix_map (lua_State *L)
}
-static int
+static gint
lua_config_add_hash_map (lua_State *L)
{
struct config_file *cfg = lua_check_config (L);
- const char *map_line;
+ const gchar *map_line;
GHashTable **r, ***ud;
if (cfg) {
@@ -442,11 +442,11 @@ lua_metric_symbol_callback (struct worker_task *task, gpointer ud)
}
}
-static int
+static gint
lua_config_register_symbol (lua_State * L)
{
struct config_file *cfg = lua_check_config (L);
- const char *name, *callback;
+ const gchar *name, *callback;
double weight;
struct lua_callback_data *cd;
@@ -465,11 +465,11 @@ lua_config_register_symbol (lua_State * L)
}
/* Radix and hash table functions */
-static int
+static gint
lua_radix_get_key (lua_State * L)
{
radix_tree_t *radix = lua_check_radix (L);
- uint32_t key;
+ guint32 key;
if (radix) {
key = luaL_checkint (L, 2);
@@ -484,11 +484,11 @@ lua_radix_get_key (lua_State * L)
return 1;
}
-static int
+static gint
lua_hash_table_get_key (lua_State * L)
{
GHashTable *tbl = lua_check_hash_table (L);
- const char *key;
+ const gchar *key;
if (tbl) {
key = luaL_checkstring (L, 2);
@@ -504,7 +504,7 @@ lua_hash_table_get_key (lua_State * L)
}
/* Trie functions */
-static int
+static gint
lua_trie_create (lua_State *L)
{
rspamd_trie_t *trie, **ptrie;
@@ -523,7 +523,7 @@ lua_trie_create (lua_State *L)
return 1;
}
-static int
+static gint
lua_trie_add_pattern (lua_State *L)
{
rspamd_trie_t *trie = lua_check_trie (L);
@@ -545,7 +545,7 @@ lua_trie_add_pattern (lua_State *L)
return 1;
}
-static int
+static gint
lua_trie_search_text (lua_State *L)
{
rspamd_trie_t *trie = lua_check_trie (L);
@@ -573,7 +573,7 @@ lua_trie_search_text (lua_State *L)
return 1;
}
-static int
+static gint
lua_trie_search_task (lua_State *L)
{
rspamd_trie_t *trie = lua_check_trie (L);
@@ -614,7 +614,7 @@ lua_trie_search_task (lua_State *L)
}
/* Init functions */
-int
+gint
luaopen_config (lua_State * L)
{
lua_newclass (L, "rspamd{config}", configlib_m);
@@ -623,7 +623,7 @@ luaopen_config (lua_State * L)
return 1;
}
-int
+gint
luaopen_radix (lua_State * L)
{
lua_newclass (L, "rspamd{radix}", radixlib_m);
@@ -632,7 +632,7 @@ luaopen_radix (lua_State * L)
return 1;
}
-int
+gint
luaopen_hash_table (lua_State * L)
{
lua_newclass (L, "rspamd{hash_table}", hashlib_m);
@@ -641,7 +641,7 @@ luaopen_hash_table (lua_State * L)
return 1;
}
-int
+gint
luaopen_trie (lua_State * L)
{
lua_newclass (L, "rspamd{trie}", trielib_m);
diff --git a/src/lua/lua_message.c b/src/lua/lua_message.c
index 98a4ae6ed..04adec24a 100644
--- a/src/lua/lua_message.c
+++ b/src/lua/lua_message.c
@@ -27,7 +27,7 @@
#include "../message.h"
#define LUA_GMIME_BRIDGE_GET(class, name, mime_class) \
-static int \
+static gint \
lua_##class##_##name(lua_State *L) \
{ \
GMime##mime_class *obj = lua_check_##class(L); \
@@ -41,10 +41,10 @@ lua_##class##_##name(lua_State *L) \
}
#define LUA_GMIME_BRIDGE_SET(class, name, mime_class) \
-static int \
+static gint \
lua_##class##_##name(lua_State *L) \
{ \
- const char *str; \
+ const gchar *str; \
GMime##mime_class *obj = lua_check_##class(L); \
if (obj != NULL) { \
str = luaL_checkstring (L, 2); \
@@ -105,13 +105,13 @@ LUA_GMIME_BRIDGE_SET (message, set_sender, Message)
LUA_GMIME_BRIDGE_GET (message, get_reply_to, Message)
LUA_GMIME_BRIDGE_SET (message, set_reply_to, Message)
-static int
+static gint
lua_message_get_header (lua_State * L)
{
- const char *headern;
+ const gchar *headern;
GMimeMessage *obj = lua_check_message (L);
GList *res = NULL, *cur;
- int i = 1;
+ gint i = 1;
if (obj != NULL) {
headern = luaL_checkstring (L, 2);
@@ -121,7 +121,7 @@ lua_message_get_header (lua_State * L)
cur = res;
lua_newtable (L);
while (cur) {
- lua_pushstring (L, (const char *)cur->data);
+ lua_pushstring (L, (const gchar *)cur->data);
lua_rawseti (L, -2, i++);
g_free (cur->data);
cur = g_list_next (cur);
@@ -144,10 +144,10 @@ lua_message_get_header (lua_State * L)
}
-static int
+static gint
lua_message_set_header (lua_State * L)
{
- const char *headern, *headerv;
+ const gchar *headern, *headerv;
GMimeMessage *obj = lua_check_message (L);
if (obj != NULL) {
@@ -168,7 +168,7 @@ lua_message_set_header (lua_State * L)
}
-int
+gint
luaopen_message (lua_State * L)
{
lua_newclass (L, "rspamd{message}", msglib_m);
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index cb9433d5e..c5adedcfe 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -39,7 +39,7 @@
#include "../statfile_sync.h"
extern stat_file_t* get_statfile_by_symbol (statfile_pool_t *pool, struct classifier_config *ccf,
- const char *symbol, struct statfile **st, gboolean try_create);
+ const gchar *symbol, struct statfile **st, gboolean try_create);
/* Task methods */
LUA_FUNCTION_DEF (task, get_message);
@@ -148,7 +148,7 @@ lua_check_image (lua_State * L)
}
/*** Task interface ***/
-static int
+static gint
lua_task_get_message (lua_State * L)
{
GMimeMessage **pmsg;
@@ -163,14 +163,14 @@ lua_task_get_message (lua_State * L)
return 1;
}
-static int
+static gint
lua_task_insert_result (lua_State * L)
{
struct worker_task *task = lua_check_task (L);
- const char *symbol_name, *param;
+ const gchar *symbol_name, *param;
double flag;
GList *params = NULL;
- int i, top;
+ gint i, top;
if (task != NULL) {
symbol_name = memory_pool_strdup (task->task_pool, luaL_checkstring (L, 2));
@@ -187,10 +187,10 @@ lua_task_insert_result (lua_State * L)
return 1;
}
-static int
+static gint
lua_task_get_urls (lua_State * L)
{
- int i = 1;
+ gint i = 1;
struct worker_task *task = lua_check_task (L);
GList *cur;
struct uri *url;
@@ -209,10 +209,10 @@ lua_task_get_urls (lua_State * L)
return 1;
}
-static int
+static gint
lua_task_get_text_parts (lua_State * L)
{
- int i = 1;
+ gint i = 1;
struct worker_task *task = lua_check_task (L);
GList *cur;
struct mime_text_part *part, **ppart;
@@ -235,7 +235,7 @@ lua_task_get_text_parts (lua_State * L)
return 1;
}
-static int
+static gint
lua_task_get_raw_headers (lua_State * L)
{
struct worker_task *task = lua_check_task (L);
@@ -250,13 +250,13 @@ lua_task_get_raw_headers (lua_State * L)
return 1;
}
-static int
+static gint
lua_task_get_received_headers (lua_State * L)
{
struct worker_task *task = lua_check_task (L);
GList *cur;
struct received_header *rh;
- int i = 1;
+ gint i = 1;
if (task) {
lua_newtable (L);
@@ -283,15 +283,15 @@ lua_task_get_received_headers (lua_State * L)
struct lua_dns_callback_data {
lua_State *L;
struct worker_task *task;
- const char *callback;
- const char *to_resolve;
+ const gchar *callback;
+ const gchar *to_resolve;
};
static void
lua_dns_callback (struct rspamd_dns_reply *reply, gpointer arg)
{
struct lua_dns_callback_data *cd = arg;
- int i = 0;
+ gint i = 0;
struct in_addr ina;
struct worker_task **ptask;
union rspamd_reply_element *elt;
@@ -365,7 +365,7 @@ lua_dns_callback (struct rspamd_dns_reply *reply, gpointer arg)
}
}
-static int
+static gint
lua_task_resolve_dns_a (lua_State * L)
{
struct worker_task *task = lua_check_task (L);
@@ -388,7 +388,7 @@ lua_task_resolve_dns_a (lua_State * L)
return 0;
}
-static int
+static gint
lua_task_resolve_dns_txt (lua_State * L)
{
struct worker_task *task = lua_check_task (L);
@@ -411,7 +411,7 @@ lua_task_resolve_dns_txt (lua_State * L)
return 0;
}
-static int
+static gint
lua_task_resolve_dns_ptr (lua_State * L)
{
struct worker_task *task = lua_check_task (L);
@@ -436,23 +436,23 @@ lua_task_resolve_dns_ptr (lua_State * L)
return 0;
}
-static int
+static gint
lua_task_call_rspamd_function (lua_State * L)
{
struct worker_task *task = lua_check_task (L);
struct expression_function f;
- int i, top;
+ gint i, top;
gboolean res;
- char *arg;
+ gchar *arg;
if (task) {
- f.name = (char *)luaL_checkstring (L, 2);
+ f.name = (gchar *)luaL_checkstring (L, 2);
if (f.name) {
f.args = NULL;
top = lua_gettop (L);
/* Get arguments after function name */
for (i = 3; i <= top; i++) {
- arg = (char *)luaL_checkstring (L, i);
+ arg = (gchar *)luaL_checkstring (L, i);
if (arg != NULL) {
f.args = g_list_prepend (f.args, arg);
}
@@ -473,11 +473,11 @@ lua_task_call_rspamd_function (lua_State * L)
}
-static int
+static gint
lua_task_get_recipients (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
- int i = 1;
+ gint i = 1;
GList *cur;
if (task) {
@@ -485,7 +485,7 @@ lua_task_get_recipients (lua_State *L)
if (cur != NULL) {
lua_newtable (L);
while (cur) {
- lua_pushstring (L, (char *)cur->data);
+ lua_pushstring (L, (gchar *)cur->data);
lua_rawseti (L, -2, i++);
cur = g_list_next (cur);
}
@@ -497,14 +497,14 @@ lua_task_get_recipients (lua_State *L)
return 1;
}
-static int
+static gint
lua_task_get_from (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
if (task) {
if (task->from != NULL) {
- lua_pushstring (L, (char *)task->from);
+ lua_pushstring (L, (gchar *)task->from);
return 1;
}
}
@@ -513,7 +513,7 @@ lua_task_get_from (lua_State *L)
return 1;
}
-static int
+static gint
lua_task_get_from_ip (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
@@ -529,7 +529,7 @@ lua_task_get_from_ip (lua_State *L)
return 1;
}
-static int
+static gint
lua_task_get_from_ip_num (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
@@ -545,7 +545,7 @@ lua_task_get_from_ip_num (lua_State *L)
return 1;
}
-static int
+static gint
lua_task_get_client_ip_num (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
@@ -561,14 +561,14 @@ lua_task_get_client_ip_num (lua_State *L)
return 1;
}
-static int
+static gint
lua_task_get_helo (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
if (task) {
if (task->helo != NULL) {
- lua_pushstring (L, (char *)task->helo);
+ lua_pushstring (L, (gchar *)task->helo);
return 1;
}
}
@@ -577,11 +577,11 @@ lua_task_get_helo (lua_State *L)
return 1;
}
-static int
+static gint
lua_task_get_images (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
- int i = 1;
+ gint i = 1;
GList *cur;
struct rspamd_image **pimg;
@@ -605,11 +605,11 @@ lua_task_get_images (lua_State *L)
}
G_INLINE_FUNC gboolean
-lua_push_symbol_result (lua_State *L, struct worker_task *task, struct metric *metric, const char *symbol)
+lua_push_symbol_result (lua_State *L, struct worker_task *task, struct metric *metric, const gchar *symbol)
{
struct metric_result *metric_res;
struct symbol *s;
- int j;
+ gint j;
GList *opt;
metric_res = g_hash_table_lookup (task->results, metric->name);
@@ -642,15 +642,15 @@ lua_push_symbol_result (lua_State *L, struct worker_task *task, struct metric *m
return FALSE;
}
-static int
+static gint
lua_task_get_symbol (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
- const char *symbol;
+ const gchar *symbol;
struct metric *metric;
GList *cur = NULL, *metric_list;
gboolean found = FALSE;
- int i = 1;
+ gint i = 1;
symbol = luaL_checkstring (L, 2);
@@ -688,11 +688,11 @@ lua_task_get_symbol (lua_State *L)
return 1;
}
-static int
+static gint
lua_task_learn_statfile (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
- const char *symbol;
+ const gchar *symbol;
struct classifier_config *cl;
GTree *tokens;
struct statfile *st;
@@ -731,11 +731,11 @@ lua_task_learn_statfile (lua_State *L)
return 1;
}
-static int
+static gint
lua_task_get_metric_score (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
- const char *metric_name;
+ const gchar *metric_name;
struct metric_result *metric_res;
metric_name = luaL_checkstring (L, 2);
@@ -759,11 +759,11 @@ lua_task_get_metric_score (lua_State *L)
return 0;
}
-static int
+static gint
lua_task_get_metric_action (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
- const char *metric_name;
+ const gchar *metric_name;
struct metric_result *metric_res;
enum rspamd_metric_action action;
@@ -785,7 +785,7 @@ lua_task_get_metric_action (lua_State *L)
/**** Textpart implementation *****/
-static int
+static gint
lua_textpart_get_content (lua_State * L)
{
struct mime_text_part *part = lua_check_textpart (L);
@@ -800,7 +800,7 @@ lua_textpart_get_content (lua_State * L)
return 1;
}
-static int
+static gint
lua_textpart_is_empty (lua_State * L)
{
struct mime_text_part *part = lua_check_textpart (L);
@@ -815,7 +815,7 @@ lua_textpart_is_empty (lua_State * L)
return 1;
}
-static int
+static gint
lua_textpart_is_html (lua_State * L)
{
struct mime_text_part *part = lua_check_textpart (L);
@@ -830,7 +830,7 @@ lua_textpart_is_html (lua_State * L)
return 1;
}
-static int
+static gint
lua_textpart_get_fuzzy (lua_State * L)
{
struct mime_text_part *part = lua_check_textpart (L);
@@ -845,7 +845,7 @@ lua_textpart_get_fuzzy (lua_State * L)
}
/* Image functions */
-static int
+static gint
lua_image_get_width (lua_State *L)
{
struct rspamd_image *img = lua_check_image (L);
@@ -859,7 +859,7 @@ lua_image_get_width (lua_State *L)
return 1;
}
-static int
+static gint
lua_image_get_height (lua_State *L)
{
struct rspamd_image *img = lua_check_image (L);
@@ -874,7 +874,7 @@ lua_image_get_height (lua_State *L)
return 1;
}
-static int
+static gint
lua_image_get_type (lua_State *L)
{
struct rspamd_image *img = lua_check_image (L);
@@ -889,7 +889,7 @@ lua_image_get_type (lua_State *L)
return 1;
}
-static int
+static gint
lua_image_get_size (lua_State *L)
{
struct rspamd_image *img = lua_check_image (L);
@@ -904,7 +904,7 @@ lua_image_get_size (lua_State *L)
return 1;
}
-static int
+static gint
lua_image_get_filename (lua_State *L)
{
struct rspamd_image *img = lua_check_image (L);
@@ -920,7 +920,7 @@ lua_image_get_filename (lua_State *L)
}
/* Init part */
-int
+gint
luaopen_task (lua_State * L)
{
lua_newclass (L, "rspamd{task}", tasklib_m);
@@ -929,7 +929,7 @@ luaopen_task (lua_State * L)
return 1;
}
-int
+gint
luaopen_textpart (lua_State * L)
{
lua_newclass (L, "rspamd{textpart}", textpartlib_m);
@@ -938,7 +938,7 @@ luaopen_textpart (lua_State * L)
return 1;
}
-int
+gint
luaopen_image (lua_State * L)
{
lua_newclass (L, "rspamd{image}", imagelib_m);