From 950bf9324c0ebd21aad8654cc6b7a4e9382d9c52 Mon Sep 17 00:00:00 2001 From: Toni Gundogdu Date: Mon, 9 Jul 2012 11:29:39 +0300 Subject: [PATCH] lua/util/exec_util_convert_entities.c: Rewrite with style changes --- src/lua/util/exec_util_convert_entities.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lua/util/exec_util_convert_entities.c b/src/lua/util/exec_util_convert_entities.c index d975e00..ce2e153 100644 --- a/src/lua/util/exec_util_convert_entities.c +++ b/src/lua/util/exec_util_convert_entities.c @@ -36,13 +36,17 @@ static const gchar script_func[] = "convert_entities"; /* Convert HTML entities in the media title. */ QuviError l_exec_util_convert_entities(_quvi_media_t m) { - _quvi_t q = m->handle.quvi; - lua_State *l = q->handle.lua; - QuviError rc = l_load_util_script(q, script_fname, script_func); + lua_State *l; + QuviError rc; + _quvi_t q; + + q = m->handle.quvi; + rc = l_load_util_script(q, script_fname, script_func); if (rc != QUVI_OK) return (rc); + l = q->handle.lua; lua_pushstring(l, m->title->str); /* 2=qargs,title [qargs: set in l_load_util_script] @@ -53,14 +57,13 @@ QuviError l_exec_util_convert_entities(_quvi_media_t m) return (QUVI_ERROR_SCRIPT); } - if (lua_isstring(l, -1)) - g_string_assign(m->title, lua_tostring(l, -1)); - else + if (!lua_isstring(l, -1)) luaL_error(l, "%s: did not return a string", script_func); + g_string_assign(m->title, lua_tostring(l, -1)); lua_pop(l, 1); - return (rc); + return (QUVI_OK); } /* vim: set ts=2 sw=2 tw=72 expandtab: */ -- 2.11.4.GIT