]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/bindings: compat for obj_len for Lua<5.2
authorMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 31 Mar 2015 20:46:13 +0000 (22:46 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 31 Mar 2015 20:46:13 +0000 (22:46 +0200)
daemon/bindings.c

index 66c54cb84f28656180c771878f24492a0edf455a..f6cfd43630034624f36a092ac6e3ed09c519fcd7 100644 (file)
@@ -21,7 +21,8 @@
 
 /** @internal Compatibility wrapper for Lua 5.0 - 5.2 */
 #if LUA_VERSION_NUM < 502
-#define lua_len lua_objlen
+#define lua_len(L, obj) \
+       lua_objlen((L), (obj))
 #define register_lib(L, name, lib) \
        luaL_openlib((L), (name), (lib), 0)
 #else
@@ -147,7 +148,7 @@ static int net_interfaces(lua_State *L)
                        buf[0] = '\0';
                }
                lua_pushstring(L, buf);
-               lua_rawseti(L, -2, lua_objlen(L, -2) + 1);
+               lua_rawseti(L, -2, lua_len(L, -2) + 1);
                lua_setfield(L, -2, "addr");
 
                /* Hardware address. */