From: Josef 'Jeff' Sipek Date: Thu, 4 Mar 2021 22:03:03 +0000 (-0500) Subject: lib-lua: Reorder compat luaL_{setfuncs,setmetatable} X-Git-Tag: 2.3.15~291 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=991e3c8cecda7eaa0687374dc8ec8cc7dfb8aacc;p=thirdparty%2Fdovecot%2Fcore.git lib-lua: Reorder compat luaL_{setfuncs,setmetatable} 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. --- diff --git a/src/lib-lua/dlua-compat.c b/src/lib-lua/dlua-compat.c index d50d2d53f9..c9ab8db388 100644 --- a/src/lib-lua/dlua-compat.c +++ b/src/lib-lua/dlua-compat.c @@ -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