]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-lua: Reorder compat luaL_{setfuncs,setmetatable}
authorJosef 'Jeff' Sipek <jeff.sipek@open-xchange.com>
Thu, 4 Mar 2021 22:03:03 +0000 (17:03 -0500)
committerjeff.sipek <jeff.sipek@open-xchange.com>
Wed, 10 Mar 2021 19:12:41 +0000 (19:12 +0000)
Switch their order to keep them alphabetical.  This will make the header
changes in the next commit a little more consistent.

Additionally, fix up the coding style.

src/lib-lua/dlua-compat.c

index d50d2d53f99284845a294d9f445328aa98de245d..c9ab8db388e59829638054fe7dbf349515e862f7 100644 (file)
@@ -5,24 +5,26 @@
 #include "dlua-script-private.h"
 
 #if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
-void luaL_setmetatable (lua_State *L, const char *tname) {
-       luaL_checkstack(L, 1, "not enough stack slots");
-       luaL_getmetatable(L, tname);
-       lua_setmetatable(L, -2);
-}
-
-void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
-       luaL_checkstack(L, nup+1, "too many upvalues");
+void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
+{
+       luaL_checkstack(L, nup + 1, "too many upvalues");
        for (; l->name != NULL; l++) {
                int i;
                lua_pushstring(L, l->name);
                for (i = 0; i < nup; i++)
-                       lua_pushvalue(L, -(nup+1));
+                       lua_pushvalue(L, -(nup + 1));
                lua_pushcclosure(L, l->func, nup);
                lua_settable(L, -(nup + 3));
        }
        lua_pop(L, nup);
 }
+
+void luaL_setmetatable(lua_State *L, const char *tname)
+{
+       luaL_checkstack(L, 1, "not enough stack slots");
+       luaL_getmetatable(L, tname);
+       lua_setmetatable(L, -2);
+}
 #endif
 
 #ifndef HAVE_LUA_ISINTEGER