aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_task.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-05 13:03:09 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-05 13:03:09 +0000
commitca6f7e1de911f557aea95996ee0de4a5e781d1b7 (patch)
tree2f9288428d739918015ecc7f84d3c87d4c8b9702 /src/lua/lua_task.c
parentcd01e044ae181a5dc22c8e7a7dca015bbeb03e55 (diff)
downloadrspamd-ca6f7e1de911f557aea95996ee0de4a5e781d1b7.tar.gz
rspamd-ca6f7e1de911f557aea95996ee0de4a5e781d1b7.zip
[Rework] Use hash tables for symbols options
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r--src/lua/lua_task.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index b43cbfeb5..8f28bb97b 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -2322,7 +2322,6 @@ lua_push_symbol_result (lua_State *L,
struct metric_result *metric_res;
struct symbol *s;
gint j;
- GList *opt;
metric_res = g_hash_table_lookup (task->results, metric->name);
if (metric_res) {
@@ -2348,14 +2347,16 @@ lua_push_symbol_result (lua_State *L,
}
if (s->options) {
- opt = s->options;
+ GHashTableIter it;
+ gpointer k, v;
+
lua_pushstring (L, "options");
- lua_newtable (L);
+ lua_createtable (L, g_hash_table_size (s->options), 0);
+ g_hash_table_iter_init (&it, s->options);
- while (opt) {
- lua_pushstring (L, opt->data);
+ while (g_hash_table_iter_next (&it, &k, &v)) {
+ lua_pushstring (L, (const char*)v);
lua_rawseti (L, -2, j++);
- opt = g_list_next (opt);
}
lua_settable (L, -3);