summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-19 22:28:44 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-19 22:28:44 +0100
commitea2e597208a72f400ec2f71c7c328a20e69d26a7 (patch)
tree77cf0748219359a372825cab95a8b458e8e138bd /src
parent235d996bf782d7cb68d2d6579c32f211142118d1 (diff)
downloadrspamd-ea2e597208a72f400ec2f71c7c328a20e69d26a7.tar.gz
rspamd-ea2e597208a72f400ec2f71c7c328a20e69d26a7.zip
Adopt new libucl.
Diffstat (limited to 'src')
-rw-r--r--src/cfg_file.h4
-rw-r--r--src/cfg_rcl.c72
-rw-r--r--src/cfg_rcl.h18
-rw-r--r--src/cfg_utils.c4
-rw-r--r--src/client/rspamc.c10
-rw-r--r--src/lua/lua_cfg_file.c2
-rw-r--r--src/lua/lua_classifier.c2
-rw-r--r--src/lua/lua_common.h2
-rw-r--r--src/lua/lua_config.c4
-rw-r--r--src/lua/lua_rcl.c21
-rw-r--r--src/lua_worker.c2
-rw-r--r--src/plugins/chartable.c2
-rw-r--r--src/plugins/dkim_check.c2
-rw-r--r--src/plugins/fuzzy_check.c10
-rw-r--r--src/plugins/regexp.c2
-rw-r--r--src/plugins/spf.c2
-rw-r--r--src/plugins/surbl.c2
-rw-r--r--src/protocol.c45
m---------src/rdns0
m---------src/ucl0
-rw-r--r--src/webui.c96
21 files changed, 155 insertions, 147 deletions
diff --git a/src/cfg_file.h b/src/cfg_file.h
index f4bdb6ec5..6038cb00d 100644
--- a/src/cfg_file.h
+++ b/src/cfg_file.h
@@ -241,7 +241,7 @@ struct rspamd_worker_param_parser {
struct rspamd_worker_cfg_parser {
struct rspamd_worker_param_parser *parsers; /**< parsers hash */
gint type; /**< workers quark */
- gboolean (*def_obj_parser)(ucl_object_t *obj, gpointer ud); /**< default object parser */
+ gboolean (*def_obj_parser)(const ucl_object_t *obj, gpointer ud); /**< default object parser */
gpointer def_ud;
UT_hash_handle hh; /**< hash by type */
};
@@ -426,7 +426,7 @@ void free_config (struct config_file *cfg);
* @param opt_name name of option to get
* @return module value or NULL if option does not defined
*/
-ucl_object_t* get_module_opt (struct config_file *cfg, const gchar *module_name,
+const ucl_object_t* get_module_opt (struct config_file *cfg, const gchar *module_name,
const gchar *opt_name);
/**
diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c
index 2d0f9b186..2714b428e 100644
--- a/src/cfg_rcl.c
+++ b/src/cfg_rcl.c
@@ -35,10 +35,10 @@
* Common section handlers
*/
static gboolean
-rspamd_rcl_logging_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_logging_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- ucl_object_t *val;
+ const ucl_object_t *val;
const gchar *facility, *log_type, *log_level;
val = ucl_object_find_key (obj, "type");
@@ -155,10 +155,10 @@ rspamd_rcl_logging_handler (struct config_file *cfg, ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_options_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_options_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- ucl_object_t *val;
+ const ucl_object_t *val;
const gchar *user_settings, *domain_settings;
/* Handle user and domain settings */
@@ -202,11 +202,11 @@ rspamd_symbols_group_find_func (gconstpointer a, gconstpointer b)
*/
static gboolean
rspamd_rcl_insert_symbol (struct config_file *cfg, struct metric *metric,
- ucl_object_t *obj, gboolean is_legacy, GError **err)
+ const ucl_object_t *obj, gboolean is_legacy, GError **err)
{
const gchar *group = "ungrouped", *description = NULL, *sym_name;
gdouble symbol_score, *score_ptr;
- ucl_object_t *val;
+ const ucl_object_t *val;
struct symbols_group *sym_group;
struct symbol_def *sym_def;
GList *metric_list, *group_list;
@@ -296,10 +296,10 @@ rspamd_rcl_insert_symbol (struct config_file *cfg, struct metric *metric,
}
static gboolean
-rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_metric_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- ucl_object_t *val, *cur;
+ const ucl_object_t *val, *cur;
const gchar *metric_name, *subject_name, *semicolon, *act_str;
struct metric *metric;
struct metric_action *action;
@@ -431,10 +431,10 @@ rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_worker_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_worker_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- ucl_object_t *val, *cur;
+ const ucl_object_t *val, *cur;
ucl_object_iter_t it = NULL;
const gchar *worker_type, *worker_bind;
GQuark qtype;
@@ -483,7 +483,7 @@ rspamd_rcl_worker_handler (struct config_file *cfg, ucl_object_t *obj,
}
}
- wrk->options = obj;
+ wrk->options = (ucl_object_t *)obj;
if (!rspamd_rcl_section_parse_defaults (section, cfg, obj, wrk, err)) {
return FALSE;
@@ -553,7 +553,7 @@ rspamd_rcl_set_lua_globals (struct config_file *cfg, lua_State *L)
}
static gboolean
-rspamd_rcl_lua_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_lua_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
const gchar *lua_src = memory_pool_strdup (cfg->cfg_pool, ucl_object_tostring (obj));
@@ -669,10 +669,10 @@ rspamd_rcl_add_module_path (struct config_file *cfg, const gchar *path, GError *
}
static gboolean
-rspamd_rcl_modules_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_modules_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- ucl_object_t *val, *cur;
+ const ucl_object_t *val, *cur;
const gchar *data;
if (obj->type == UCL_OBJECT) {
@@ -700,11 +700,11 @@ rspamd_rcl_modules_handler (struct config_file *cfg, ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_statfile_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_statfile_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct classifier_config *ccf = ud;
- ucl_object_t *val;
+ const ucl_object_t *val;
struct statfile *st;
const gchar *data;
gdouble binlog_rotate;
@@ -765,7 +765,7 @@ rspamd_rcl_statfile_handler (struct config_file *cfg, ucl_object_t *obj,
return FALSE;
}
- st->opts = obj;
+ st->opts = (ucl_object_t *)obj;
val = ucl_object_find_key (obj, "spam");
if (val == NULL) {
@@ -790,10 +790,10 @@ rspamd_rcl_statfile_handler (struct config_file *cfg, ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_classifier_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_classifier_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- ucl_object_t *val, *cur;
+ const ucl_object_t *val, *cur;
ucl_object_iter_t it = NULL;
const gchar *key, *type;
struct classifier_config *ccf, *found = NULL;
@@ -860,10 +860,10 @@ rspamd_rcl_classifier_handler (struct config_file *cfg, ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_composite_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_composite_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- ucl_object_t *val;
+ const ucl_object_t *val;
struct expression *expr;
struct rspamd_composite *composite;
const gchar *composite_name, *composite_expression;
@@ -904,10 +904,10 @@ rspamd_rcl_composite_handler (struct config_file *cfg, ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_view_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_view_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- ucl_object_t *val, *cur;
+ const ucl_object_t *val, *cur;
struct rspamd_view *view;
const gchar *view_ip, *view_client_ip, *view_symbols,
*view_rcpt, *view_from;
@@ -975,7 +975,7 @@ rspamd_rcl_view_handler (struct config_file *cfg, ucl_object_t *obj,
* for default handlers
*/
static gboolean
-rspamd_rcl_empty_handler (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_empty_handler (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
return rspamd_rcl_section_parse_defaults (section, cfg, obj, cfg, err);
@@ -1200,9 +1200,9 @@ rspamd_rcl_config_get_section (struct rspamd_rcl_section *top,
gboolean
rspamd_read_rcl_config (struct rspamd_rcl_section *top,
- struct config_file *cfg, ucl_object_t *obj, GError **err)
+ struct config_file *cfg, const ucl_object_t *obj, GError **err)
{
- ucl_object_t *found, *cur_obj;
+ const ucl_object_t *found, *cur_obj;
struct rspamd_rcl_section *cur, *tmp;
if (obj->type != UCL_OBJECT) {
@@ -1238,16 +1238,16 @@ rspamd_read_rcl_config (struct rspamd_rcl_section *top,
}
}
- cfg->rcl_obj = obj;
+ cfg->rcl_obj = (ucl_object_t *)obj;
return TRUE;
}
gboolean rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
- struct config_file *cfg, ucl_object_t *obj, gpointer ptr,
+ struct config_file *cfg, const ucl_object_t *obj, gpointer ptr,
GError **err)
{
- ucl_object_t *found;
+ const ucl_object_t *found;
struct rspamd_rcl_default_handler_data *cur, *tmp;
if (obj->type != UCL_OBJECT) {
@@ -1269,7 +1269,7 @@ gboolean rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
}
gboolean
-rspamd_rcl_parse_struct_string (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_parse_struct_string (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1302,7 +1302,7 @@ rspamd_rcl_parse_struct_string (struct config_file *cfg, ucl_object_t *obj,
}
gboolean
-rspamd_rcl_parse_struct_integer (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_parse_struct_integer (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1360,7 +1360,7 @@ rspamd_rcl_parse_struct_integer (struct config_file *cfg, ucl_object_t *obj,
}
gboolean
-rspamd_rcl_parse_struct_double (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_parse_struct_double (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1377,7 +1377,7 @@ rspamd_rcl_parse_struct_double (struct config_file *cfg, ucl_object_t *obj,
}
gboolean
-rspamd_rcl_parse_struct_time (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_parse_struct_time (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1426,13 +1426,13 @@ rspamd_rcl_parse_struct_time (struct config_file *cfg, ucl_object_t *obj,
}
gboolean
-rspamd_rcl_parse_struct_string_list (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_parse_struct_string_list (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
GList **target;
gchar *val;
- ucl_object_t *cur;
+ const ucl_object_t *cur;
const gsize num_str_len = 32;
ucl_object_iter_t iter = NULL;
@@ -1474,7 +1474,7 @@ rspamd_rcl_parse_struct_string_list (struct config_file *cfg, ucl_object_t *obj,
}
gboolean
-rspamd_rcl_parse_struct_boolean (struct config_file *cfg, ucl_object_t *obj,
+rspamd_rcl_parse_struct_boolean (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
diff --git a/src/cfg_rcl.h b/src/cfg_rcl.h
index 39ce2fc43..99839d1ea 100644
--- a/src/cfg_rcl.h
+++ b/src/cfg_rcl.h
@@ -63,7 +63,7 @@ struct rspamd_rcl_struct_parser {
* @param err error object
* @return TRUE if a section has been parsed
*/
-typedef gboolean (*rspamd_rcl_handler_t) (struct config_file *cfg, ucl_object_t *obj,
+typedef gboolean (*rspamd_rcl_handler_t) (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -116,7 +116,7 @@ struct rspamd_rcl_section *rspamd_rcl_config_get_section (struct rspamd_rcl_sect
* @return TRUE if an object can be parsed
*/
gboolean rspamd_read_rcl_config (struct rspamd_rcl_section *top,
- struct config_file *cfg, ucl_object_t *obj, GError **err);
+ struct config_file *cfg, const ucl_object_t *obj, GError **err);
/**
@@ -129,7 +129,7 @@ gboolean rspamd_read_rcl_config (struct rspamd_rcl_section *top,
* @return TRUE if the object has been parsed
*/
gboolean rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
- struct config_file *cfg, ucl_object_t *obj, gpointer ptr,
+ struct config_file *cfg, const ucl_object_t *obj, gpointer ptr,
GError **err);
/**
* Here is a section of common handlers that accepts rcl_struct_parser
@@ -146,7 +146,7 @@ gboolean rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
* @param err error pointer
* @return TRUE if a string value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_string (struct config_file *cfg, ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_string (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -158,7 +158,7 @@ gboolean rspamd_rcl_parse_struct_string (struct config_file *cfg, ucl_object_t *
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_integer (struct config_file *cfg, ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_integer (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
@@ -171,7 +171,7 @@ gboolean rspamd_rcl_parse_struct_integer (struct config_file *cfg, ucl_object_t
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_double (struct config_file *cfg, ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_double (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -183,7 +183,7 @@ gboolean rspamd_rcl_parse_struct_double (struct config_file *cfg, ucl_object_t *
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_time (struct config_file *cfg, ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_time (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -195,7 +195,7 @@ gboolean rspamd_rcl_parse_struct_time (struct config_file *cfg, ucl_object_t *ob
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_string_list (struct config_file *cfg, ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_string_list (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -207,7 +207,7 @@ gboolean rspamd_rcl_parse_struct_string_list (struct config_file *cfg, ucl_objec
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_boolean (struct config_file *cfg, ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_boolean (struct config_file *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
diff --git a/src/cfg_utils.c b/src/cfg_utils.c
index 316b649cc..a83f63573 100644
--- a/src/cfg_utils.c
+++ b/src/cfg_utils.c
@@ -337,10 +337,10 @@ free_config (struct config_file *cfg)
memory_pool_delete (cfg->cfg_pool);
}
-ucl_object_t *
+const ucl_object_t *
get_module_opt (struct config_file *cfg, const gchar *module_name, const gchar *opt_name)
{
- ucl_object_t *res = NULL, *sec;
+ const ucl_object_t *res = NULL, *sec;
sec = ucl_obj_get_key (cfg->rcl_obj, module_name);
if (sec != NULL) {
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 8defef0f4..8ef9ebad0 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -374,9 +374,9 @@ add_options (GHashTable *opts)
}
static void
-rspamc_symbol_ouptut (ucl_object_t *obj)
+rspamc_symbol_ouptut (const ucl_object_t *obj)
{
- ucl_object_t *cur, *it;
+ const ucl_object_t *cur, *it;
rspamd_fprintf (stdout, "Symbol: %s ", ucl_object_key (obj));
cur = ucl_object_find_key (obj, "score");
@@ -403,10 +403,10 @@ rspamc_symbol_ouptut (ucl_object_t *obj)
}
static void
-rspamc_metric_output (ucl_object_t *obj)
+rspamc_metric_output (const ucl_object_t *obj)
{
ucl_object_iter_t it = NULL;
- ucl_object_t *cur;
+ const ucl_object_t *cur;
gdouble score, required_score;
gint got_scores = 0;
@@ -442,7 +442,7 @@ static void
rspamc_symbols_output (ucl_object_t *obj)
{
ucl_object_iter_t it = NULL;
- ucl_object_t *cur;
+ const ucl_object_t *cur;
gchar *emitted;
while ((cur = ucl_iterate_object (obj, &it, true)) != NULL) {
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index 6fe773987..9e636ecef 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -140,7 +140,7 @@ lua_post_load_config (struct config_file *cfg)
if (name != NULL && lua_istable (L, -1)) {
obj = lua_rcl_obj_get (L, -1);
if (obj != NULL) {
- cfg->rcl_obj = ucl_object_insert_key_merged (cfg->rcl_obj, obj, name, keylen, true);
+ ucl_object_insert_key_merged (cfg->rcl_obj, obj, name, keylen, true);
}
}
}
diff --git a/src/lua/lua_classifier.c b/src/lua/lua_classifier.c
index be574319a..82e7ea2b7 100644
--- a/src/lua/lua_classifier.c
+++ b/src/lua/lua_classifier.c
@@ -382,7 +382,7 @@ lua_statfile_get_param (lua_State *L)
{
struct statfile *st = lua_check_statfile (L);
const gchar *param;
- ucl_object_t *value;
+ const ucl_object_t *value;
param = luaL_checkstring (L, 2);
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index cdce7b3d3..d03ca168e 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -114,7 +114,7 @@ void free_lua_locked (struct lua_locked_state *st);
* @param L lua state
* @param obj object to push
*/
-gint lua_rcl_obj_push (lua_State *L, ucl_object_t *obj, gboolean allow_array);
+gint lua_rcl_obj_push (lua_State *L, const ucl_object_t *obj, gboolean allow_array);
/**
* Extract rcl object from lua object
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 7987fa00e..acf3ae3be 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -156,7 +156,7 @@ lua_config_get_module_opt (lua_State * L)
{
struct config_file *cfg = lua_check_config (L);
const gchar *mname, *optname;
- ucl_object_t *obj;
+ const ucl_object_t *obj;
if (cfg) {
mname = luaL_checkstring (L, 2);
@@ -192,7 +192,7 @@ lua_config_get_all_opt (lua_State * L)
{
struct config_file *cfg = lua_check_config (L);
const gchar *mname;
- ucl_object_t *obj;
+ const ucl_object_t *obj;
if (cfg) {
mname = luaL_checkstring (L, 2);
diff --git a/src/lua/lua_rcl.c b/src/lua/lua_rcl.c
index 2768ac4a4..efedc0725 100644
--- a/src/lua/lua_rcl.c
+++ b/src/lua/lua_rcl.c
@@ -27,8 +27,8 @@
* @file lua rcl bindings
*/
-static gint lua_rcl_obj_push_array (lua_State *L, ucl_object_t *obj);
-static gint lua_rcl_obj_push_simple (lua_State *L, ucl_object_t *obj, gboolean allow_array);
+static gint lua_rcl_obj_push_array (lua_State *L, const ucl_object_t *obj);
+static gint lua_rcl_obj_push_simple (lua_State *L, const ucl_object_t *obj, gboolean allow_array);
static ucl_object_t* lua_rcl_table_get (lua_State *L, gint idx);
static ucl_object_t* lua_rcl_elt_get (lua_State *L, gint idx);
@@ -39,7 +39,7 @@ static ucl_object_t* lua_rcl_elt_get (lua_State *L, gint idx);
* @param obj
*/
static void
-lua_rcl_obj_push_elt (lua_State *L, const char *key, ucl_object_t *obj)
+lua_rcl_obj_push_elt (lua_State *L, const char *key, const ucl_object_t *obj)
{
lua_pushstring (L, key);
lua_rcl_obj_push (L, obj, TRUE);
@@ -53,9 +53,9 @@ lua_rcl_obj_push_elt (lua_State *L, const char *key, ucl_object_t *obj)
* @return
*/
static gint
-lua_rcl_obj_push_obj (lua_State *L, ucl_object_t *obj, gboolean allow_array)
+lua_rcl_obj_push_obj (lua_State *L, const ucl_object_t *obj, gboolean allow_array)
{
- ucl_object_t *cur;
+ const ucl_object_t *cur;
ucl_object_iter_t it = NULL;
if (allow_array && obj->next != NULL) {
@@ -78,9 +78,9 @@ lua_rcl_obj_push_obj (lua_State *L, ucl_object_t *obj, gboolean allow_array)
* @return
*/
static gint
-lua_rcl_obj_push_array (lua_State *L, ucl_object_t *obj)
+lua_rcl_obj_push_array (lua_State *L, const ucl_object_t *obj)
{
- ucl_object_t *cur;
+ const ucl_object_t *cur;
gint i = 1;
lua_newtable (L);
@@ -98,7 +98,7 @@ lua_rcl_obj_push_array (lua_State *L, ucl_object_t *obj)
* Push a simple object to lua depending on its actual type
*/
static gint
-lua_rcl_obj_push_simple (lua_State *L, ucl_object_t *obj, gboolean allow_array)
+lua_rcl_obj_push_simple (lua_State *L, const ucl_object_t *obj, gboolean allow_array)
{
if (allow_array && obj->next != NULL) {
/* Actually we need to push this as an array */
@@ -137,7 +137,7 @@ lua_rcl_obj_push_simple (lua_State *L, ucl_object_t *obj, gboolean allow_array)
* @param obj object to push
*/
gint
-lua_rcl_obj_push (lua_State *L, ucl_object_t *obj, gboolean allow_array)
+lua_rcl_obj_push (lua_State *L, const ucl_object_t *obj, gboolean allow_array)
{
switch (obj->type) {
case UCL_OBJECT:
@@ -165,12 +165,13 @@ lua_rcl_table_get (lua_State *L, gint idx)
/* Table iterate */
lua_pushvalue (L, idx);
lua_pushnil (L);
+ top = ucl_object_typed_new (UCL_OBJECT);
while (lua_next (L, -2) != 0) {
/* copy key to avoid modifications */
lua_pushvalue (L, -2);
k = lua_tolstring (L, -1, &keylen);
obj = lua_rcl_elt_get (L, -2);
- top = ucl_object_insert_key (top, obj, k, keylen, true);
+ ucl_object_insert_key (top, obj, k, keylen, true);
lua_pop (L, 2);
}
lua_pop (L, 1);
diff --git a/src/lua_worker.c b/src/lua_worker.c
index e9b06f508..2bf4a9a9f 100644
--- a/src/lua_worker.c
+++ b/src/lua_worker.c
@@ -191,7 +191,7 @@ static int
lua_worker_get_option (lua_State *L)
{
struct rspamd_lua_worker_ctx *ctx = lua_check_lua_worker (L);
- ucl_object_t *val;
+ const ucl_object_t *val;
const gchar *name;
if (ctx) {
diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c
index ec848f6df..47b5efd7e 100644
--- a/src/plugins/chartable.c
+++ b/src/plugins/chartable.c
@@ -84,7 +84,7 @@ chartable_module_init (struct config_file *cfg, struct module_ctx **ctx)
gint
chartable_module_config (struct config_file *cfg)
{
- ucl_object_t *value;
+ const ucl_object_t *value;
gint res = TRUE;
if ((value = get_module_opt (cfg, "chartable", "symbol")) != NULL) {
diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c
index b7c5515e5..225f781c0 100644
--- a/src/plugins/dkim_check.c
+++ b/src/plugins/dkim_check.c
@@ -103,7 +103,7 @@ dkim_module_init (struct config_file *cfg, struct module_ctx **ctx)
gint
dkim_module_config (struct config_file *cfg)
{
- ucl_object_t *value;
+ const ucl_object_t *value;
gint res = TRUE;
guint cache_size, cache_expire;
gboolean got_trusted = FALSE;
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 2f48548a5..d1e55a678 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -149,9 +149,9 @@ module_t fuzzy_check_module = {
};
static void
-parse_flags (struct fuzzy_rule *rule, struct config_file *cfg, ucl_object_t *val)
+parse_flags (struct fuzzy_rule *rule, struct config_file *cfg, const ucl_object_t *val)
{
- ucl_object_t *elt;
+ const ucl_object_t *elt;
struct fuzzy_mapping *map;
const gchar *sym = NULL;
@@ -325,9 +325,9 @@ fuzzy_rule_new (const char *default_symbol, memory_pool_t *pool)
}
static gint
-fuzzy_parse_rule (struct config_file *cfg, ucl_object_t *obj)
+fuzzy_parse_rule (struct config_file *cfg, const ucl_object_t *obj)
{
- ucl_object_t *value, *cur;
+ const ucl_object_t *value, *cur;
struct fuzzy_rule *rule;
ucl_object_iter_t it = NULL;
@@ -404,7 +404,7 @@ fuzzy_check_module_init (struct config_file *cfg, struct module_ctx **ctx)
gint
fuzzy_check_module_config (struct config_file *cfg)
{
- ucl_object_t *value, *cur;
+ const ucl_object_t *value, *cur;
gint res = TRUE;
if ((value = get_module_opt (cfg, "fuzzy_check", "symbol")) != NULL) {
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index ece8a53fc..6569dd150 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -570,7 +570,7 @@ gint
regexp_module_config (struct config_file *cfg)
{
struct regexp_module_item *cur_item;
- ucl_object_t *sec, *value;
+ const ucl_object_t *sec, *value;
ucl_object_iter_t it = NULL;
gint res = TRUE;
struct regexp_json_buf *jb, **pjb;
diff --git a/src/plugins/spf.c b/src/plugins/spf.c
index 99e7f664e..395313067 100644
--- a/src/plugins/spf.c
+++ b/src/plugins/spf.c
@@ -95,7 +95,7 @@ spf_module_init (struct config_file *cfg, struct module_ctx **ctx)
gint
spf_module_config (struct config_file *cfg)
{
- ucl_object_t *value;
+ const ucl_object_t *value;
gint res = TRUE;
guint cache_size, cache_expire;
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 8478907f1..585e174fb 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -269,7 +269,7 @@ surbl_module_config (struct config_file *cfg)
struct suffix_item *new_suffix, *cur_suffix = NULL;
struct surbl_bit_item *new_bit;
- ucl_object_t *value, *cur, *cur_rule, *cur_bit;
+ const ucl_object_t *value, *cur, *cur_rule, *cur_bit;
ucl_object_iter_t it = NULL;
const gchar *redir_val;
guint32 bit;
diff --git a/src/protocol.c b/src/protocol.c
index 6a9ed3de6..b0b70954c 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -592,13 +592,14 @@ rspamd_metric_symbol_ucl (struct worker_task *task, struct metric *m,
rspamd_printf_gstring (logbuf, "%s,", sym->name);
description = g_hash_table_lookup (m->descriptions, sym->name);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (sym->name), "name", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromdouble (sym->score), "score", 0, false);
+ obj = ucl_object_typed_new (UCL_OBJECT);
+ ucl_object_insert_key (obj, ucl_object_fromstring (sym->name), "name", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromdouble (sym->score), "score", 0, false);
if (description) {
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (description), "description", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromstring (description), "description", 0, false);
}
if (sym->options != NULL) {
- obj = ucl_object_insert_key (obj, rspamd_str_list_ucl (sym->options), "options", 0, false);
+ ucl_object_insert_key (obj, rspamd_str_list_ucl (sym->options), "options", 0, false);
}
return obj;
@@ -638,20 +639,21 @@ rspamd_metric_result_ucl (struct worker_task *task, struct metric_result *mres,
str_action_metric (action),
mres->score, required_score);
- obj = ucl_object_insert_key (obj, ucl_object_frombool (is_spam),
+ obj = ucl_object_typed_new (UCL_OBJECT);
+ ucl_object_insert_key (obj, ucl_object_frombool (is_spam),
"is_spam", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_frombool (task->is_skipped),
+ ucl_object_insert_key (obj, ucl_object_frombool (task->is_skipped),
"is_skipped", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromdouble (mres->score),
+ ucl_object_insert_key (obj, ucl_object_fromdouble (mres->score),
"score", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromdouble (required_score),
+ ucl_object_insert_key (obj, ucl_object_fromdouble (required_score),
"required_score", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (str_action_metric (action)),
+ ucl_object_insert_key (obj, ucl_object_fromstring (str_action_metric (action)),
"action", 0, false);
if (action == METRIC_ACTION_REWRITE_SUBJECT) {
subject = make_rewritten_subject (m, task);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (subject),
+ ucl_object_insert_key (obj, ucl_object_fromstring (subject),
"subject", 0, false);
}
/* Now handle symbols */
@@ -659,7 +661,7 @@ rspamd_metric_result_ucl (struct worker_task *task, struct metric_result *mres,
while (g_hash_table_iter_next (&hiter, &h, &v)) {
sym = (struct symbol *)v;
sobj = rspamd_metric_symbol_ucl (task, m, sym, logbuf);
- obj = ucl_object_insert_key (obj, sobj, h, 0, false);
+ ucl_object_insert_key (obj, sobj, h, 0, false);
}
/* Cut the trailing comma if needed */
@@ -684,7 +686,8 @@ rspamd_metric_result_ucl (struct worker_task *task, struct metric_result *mres,
static void
rspamd_ucl_tolegacy_output (struct worker_task *task, ucl_object_t *top, GString *out)
{
- ucl_object_t *metric, *score, *required_score, *is_spam, *elt, *symbols;
+ const ucl_object_t *metric, *score,
+ *required_score, *is_spam, *elt, *symbols;
ucl_object_iter_t iter = NULL;
metric = ucl_object_find_key (top, DEFAULT_METRIC);
@@ -704,7 +707,7 @@ rspamd_ucl_tolegacy_output (struct worker_task *task, ucl_object_t *top, GString
symbols = ucl_object_find_key (metric, "symbols");
while ((elt = ucl_iterate_object (symbols, &iter, true)) != NULL) {
- ucl_object_t *sym_score;
+ const ucl_object_t *sym_score;
sym_score = ucl_object_find_key (elt, "score");
g_string_append_printf (out, "Symbol: %s; %.2f\r\n",
ucl_object_key (elt),
@@ -742,24 +745,27 @@ write_check_reply (struct rspamd_http_message *msg, struct worker_task *task)
}
g_hash_table_iter_init (&hiter, task->results);
+ top = ucl_object_typed_new (UCL_OBJECT);
/* Convert results to an ucl object */
while (g_hash_table_iter_next (&hiter, &h, &v)) {
metric_res = (struct metric_result *)v;
obj = rspamd_metric_result_ucl (task, metric_res, logbuf);
- top = ucl_object_insert_key (top, obj, h, 0, false);
+ ucl_object_insert_key (top, obj, h, 0, false);
}
if (task->messages != NULL) {
- top = ucl_object_insert_key (top, rspamd_str_list_ucl (task->messages), "messages", 0, false);
+ ucl_object_insert_key (top, rspamd_str_list_ucl (task->messages), "messages", 0, false);
}
if (g_tree_nnodes (task->urls) > 0) {
- top = ucl_object_insert_key (top, rspamd_urls_tree_ucl (task->urls, task), "urls", 0, false);
+ ucl_object_insert_key (top, rspamd_urls_tree_ucl (task->urls, task), "urls", 0, false);
}
if (g_tree_nnodes (task->emails) > 0) {
- top = ucl_object_insert_key (top, rspamd_emails_tree_ucl (task->emails, task), "emails", 0, false);
+ ucl_object_insert_key (top, rspamd_emails_tree_ucl (task->emails, task),
+ "emails", 0, false);
}
- top = ucl_object_insert_key (top, ucl_object_fromstring (task->message_id), "message-id", 0, false);
+ ucl_object_insert_key (top, ucl_object_fromstring (task->message_id),
+ "message-id", 0, false);
write_hashes_to_log (task, logbuf);
if (!task->no_log) {
@@ -797,10 +803,11 @@ rspamd_protocol_write_reply (struct worker_task *task)
task->state = CLOSING_CONNECTION;
+ top = ucl_object_typed_new (UCL_OBJECT);
debug_task ("writing reply to client");
if (task->error_code != 0) {
msg->code = task->error_code;
- top = ucl_object_insert_key (top, ucl_object_fromstring (task->last_error), "error", 0, false);
+ ucl_object_insert_key (top, ucl_object_fromstring (task->last_error), "error", 0, false);
msg->body = g_string_sized_new (256);
rspamd_ucl_emit_gstring (top, UCL_EMIT_JSON_COMPACT, msg->body);
ucl_object_unref (top);
diff --git a/src/rdns b/src/rdns
-Subproject b1762224e9c8015abd195282ebd2f7728076e23
+Subproject 2838695f608ed5bb4ef3ed9dfd4d0a095bca205
diff --git a/src/ucl b/src/ucl
-Subproject 8eb6d5601a8eec27cffa84479281207f726482d
+Subproject 80ec7720f562baccc9d0205ca2fa54d70549a2e
diff --git a/src/webui.c b/src/webui.c
index 829ea8e61..8b0fd8787 100644
--- a/src/webui.c
+++ b/src/webui.c
@@ -684,15 +684,15 @@ rspamd_webui_handle_auth (struct rspamd_http_connection_entry *conn_ent,
/* Get uptime */
uptime = time (NULL) - session->ctx->start_time;
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (RVERSION), "version", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring ("ok"), "auth", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (uptime), "uptime", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (data[0]), "clean", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (data[1]), "probable", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (data[2]), "greylist", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (data[3]), "reject", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (st->messages_scanned), "scanned", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (st->messages_learned), "learned", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromstring (RVERSION), "version", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromstring ("ok"), "auth", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromint (uptime), "uptime", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromint (data[0]), "clean", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromint (data[1]), "probable", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromint (data[2]), "greylist", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromint (data[3]), "reject", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromint (st->messages_scanned), "scanned", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromint (st->messages_learned), "learned", 0, false);
rspamd_webui_send_ucl (conn_ent, obj);
ucl_object_unref (obj);
@@ -736,27 +736,27 @@ rspamd_webui_handle_symbols (struct rspamd_http_connection_entry *conn_ent,
while (cur_gr) {
gr = cur_gr->data;
obj = ucl_object_typed_new (UCL_OBJECT);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (gr->name), "group", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromstring (gr->name), "group", 0, false);
/* Iterate through all symbols */
cur_sym = gr->symbols;
while (cur_sym) {
sym_obj = ucl_object_typed_new (UCL_OBJECT);
sym = cur_sym->data;
- sym_obj = ucl_object_insert_key (sym_obj, ucl_object_fromstring (sym->name),
+ ucl_object_insert_key (sym_obj, ucl_object_fromstring (sym->name),
"symbol", 0, false);
- sym_obj = ucl_object_insert_key (sym_obj, ucl_object_fromdouble (*sym->weight_ptr),
+ ucl_object_insert_key (sym_obj, ucl_object_fromdouble (*sym->weight_ptr),
"weight", 0, false);
if (sym->description) {
- sym_obj = ucl_object_insert_key (sym_obj, ucl_object_fromstring (sym->description),
+ ucl_object_insert_key (sym_obj, ucl_object_fromstring (sym->description),
"description", 0, false);
}
- obj = ucl_object_insert_key (obj, sym_obj, "rules", 0, false);
+ ucl_object_insert_key (obj, sym_obj, "rules", 0, false);
cur_sym = g_list_next (cur_sym);
}
cur_gr = g_list_next (cur_gr);
- top = ucl_array_append (top, obj);
+ ucl_array_append (top, obj);
}
rspamd_webui_send_ucl (conn_ent, top);
@@ -797,10 +797,10 @@ rspamd_webui_handle_actions (struct rspamd_http_connection_entry *conn_ent,
act = &metric->actions[i];
if (act->score > 0) {
obj = ucl_object_typed_new (UCL_OBJECT);
- obj = ucl_object_insert_key (obj,
+ ucl_object_insert_key (obj,
ucl_object_fromstring (str_action_metric (act->action)), "action", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromdouble (act->score), "value", 0, false);
- top = ucl_array_append (top, obj);
+ ucl_object_insert_key (obj, ucl_object_fromdouble (act->score), "value", 0, false);
+ ucl_array_append (top, obj);
}
}
}
@@ -857,13 +857,13 @@ rspamd_webui_handle_maps (struct rspamd_http_connection_entry *conn_ent,
editable = (access (map->uri, W_OK) == 0);
obj = ucl_object_typed_new (UCL_OBJECT);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (map->id),
+ ucl_object_insert_key (obj, ucl_object_fromint (map->id),
"map", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (map->description),
+ ucl_object_insert_key (obj, ucl_object_fromstring (map->description),
"description", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_frombool (editable),
+ ucl_object_insert_key (obj, ucl_object_frombool (editable),
"editable", 0, false);
- top = ucl_array_append (top, obj);
+ ucl_array_append (top, obj);
cur = g_list_next (cur);
}
@@ -1107,25 +1107,25 @@ rspamd_webui_handle_pie_chart (struct rspamd_http_connection_entry *conn_ent,
data[2] = ctx->srv->stat->actions_stat[METRIC_ACTION_GREYLIST] / total * 100.;
data[3] = ctx->srv->stat->actions_stat[METRIC_ACTION_REJECT] / total * 100.;
- obj = ucl_array_append (obj, ucl_object_fromstring ("Clean messages"));
- obj = ucl_array_append (obj, ucl_object_fromdouble (data[0]));
- top = ucl_array_append (top, obj);
- obj = ucl_array_append (obj, ucl_object_fromstring ("Probable spam messages"));
- obj = ucl_array_append (obj, ucl_object_fromdouble (data[1]));
- top = ucl_array_append (top, obj);
- obj = ucl_array_append (obj, ucl_object_fromstring ("Greylisted messages"));
- obj = ucl_array_append (obj, ucl_object_fromdouble (data[2]));
- top = ucl_array_append (top, obj);
- obj = ucl_array_append (obj, ucl_object_fromstring ("Rejected messages"));
- obj = ucl_array_append (obj, ucl_object_fromdouble (data[3]));
- top = ucl_array_append (top, obj);
+ ucl_array_append (obj, ucl_object_fromstring ("Clean messages"));
+ ucl_array_append (obj, ucl_object_fromdouble (data[0]));
+ ucl_array_append (top, obj);
+ ucl_array_append (obj, ucl_object_fromstring ("Probable spam messages"));
+ ucl_array_append (obj, ucl_object_fromdouble (data[1]));
+ ucl_array_append (top, obj);
+ ucl_array_append (obj, ucl_object_fromstring ("Greylisted messages"));
+ ucl_array_append (obj, ucl_object_fromdouble (data[2]));
+ ucl_array_append (top, obj);
+ ucl_array_append (obj, ucl_object_fromstring ("Rejected messages"));
+ ucl_array_append (obj, ucl_object_fromdouble (data[3]));
+ ucl_array_append (top, obj);
}
else {
obj = ucl_object_typed_new (UCL_ARRAY);
- obj = ucl_array_append (obj, ucl_object_fromstring ("Scanned messages"));
- obj = ucl_array_append (obj, ucl_object_fromdouble (0));
- top = ucl_array_append (top, obj);
+ ucl_array_append (obj, ucl_object_fromstring ("Scanned messages"));
+ ucl_array_append (obj, ucl_object_fromdouble (0));
+ ucl_array_append (top, obj);
}
rspamd_webui_send_ucl (conn_ent, top);
@@ -1195,20 +1195,20 @@ rspamd_webui_handle_history (struct rspamd_http_connection_entry *conn_ent,
rspamd_strlcpy (ip_buf, inet_ntoa (task->from_addr), sizeof (ip_buf));
#endif
obj = ucl_object_typed_new (UCL_OBJECT);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (timebuf), "time", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (row->message_id), "id", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (ip_buf), "ip", 0, false);
- obj = ucl_object_insert_key (obj,
+ ucl_object_insert_key (obj, ucl_object_fromstring (timebuf), "time", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromstring (row->message_id), "id", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromstring (ip_buf), "ip", 0, false);
+ ucl_object_insert_key (obj,
ucl_object_fromstring (str_action_metric (row->action)), "action", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromdouble (row->score), "score", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromdouble (row->required_score), "required_score", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (row->symbols), "symbols", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (row->len), "size", 0, false);
- obj = ucl_object_insert_key (obj, ucl_object_fromint (row->scan_time), "scan_time", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromdouble (row->score), "score", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromdouble (row->required_score), "required_score", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromstring (row->symbols), "symbols", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromint (row->len), "size", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromint (row->scan_time), "scan_time", 0, false);
if (row->user[0] != '\0') {
- obj = ucl_object_insert_key (obj, ucl_object_fromstring (row->user), "user", 0, false);
+ ucl_object_insert_key (obj, ucl_object_fromstring (row->user), "user", 0, false);
}
- top = ucl_array_append (top, obj);
+ ucl_array_append (top, obj);
rows_proc ++;
}
}