From ca6f7e1de911f557aea95996ee0de4a5e781d1b7 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 5 Dec 2016 13:03:09 +0000 Subject: [Rework] Use hash tables for symbols options --- src/lua/lua_task.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/lua/lua_task.c') 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); -- cgit v1.2.3