]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-lua: Make dlua_dump_stack() take lua_State * directly
authorJosef 'Jeff' Sipek <jeff.sipek@open-xchange.com>
Thu, 17 Dec 2020 18:07:52 +0000 (13:07 -0500)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 15 Jan 2021 13:32:57 +0000 (13:32 +0000)
src/lib-lua/dlua-script-private.h
src/lib-lua/dlua-script.c

index ab877d480adc42af67111323d9f140b95eb1f39e..a9762b219997605b9e48bedf7b590b43cb991719 100644 (file)
@@ -105,6 +105,6 @@ void dlua_push_event(lua_State *L, struct event *event);
 struct event *dlua_check_event(lua_State *L, int arg);
 
 /* dumps current stack as i_debug lines */
-void dlua_dump_stack(struct dlua_script *script);
+void dlua_dump_stack(lua_State *L);
 
 #endif
index d4bf6f1b5b758cee0b4ae1a8458696b826c6caf3..1acc6040ebb9ba804179370f77d77a9c2b272653 100644 (file)
@@ -372,26 +372,26 @@ void dlua_setmembers(lua_State *L, const struct dlua_table_values *values,
        }
 }
 
-void dlua_dump_stack(struct dlua_script *script)
+void dlua_dump_stack(lua_State *L)
 {
        /* get everything in stack */
-       int top = lua_gettop(script->L);
+       int top = lua_gettop(L);
        for (int i = 1; i <= top; i++) T_BEGIN {  /* repeat for each level */
-               int t = lua_type(script->L, i);
+               int t = lua_type(L, i);
                string_t *line = t_str_new(32);
                str_printfa(line, "#%d: ", i);
                switch (t) {
                case LUA_TSTRING:  /* strings */
-                       str_printfa(line, "`%s'", lua_tostring(script->L, i));
+                       str_printfa(line, "`%s'", lua_tostring(L, i));
                        break;
                case LUA_TBOOLEAN:  /* booleans */
-                       str_printfa(line, "`%s'", lua_toboolean(script->L, i) ? "true" : "false");
+                       str_printfa(line, "`%s'", lua_toboolean(L, i) ? "true" : "false");
                        break;
                case LUA_TNUMBER:  /* numbers */
-                       str_printfa(line, "%g", lua_tonumber(script->L, i));
+                       str_printfa(line, "%g", lua_tonumber(L, i));
                        break;
                default:  /* other values */
-                       str_printfa(line, "%s", lua_typename(script->L, t));
+                       str_printfa(line, "%s", lua_typename(L, t));
                        break;
                }
                i_debug("%s", str_c(line));