aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_blocklist.lua5
-rw-r--r--util-src/crand.c2
-rw-r--r--util-src/net.c2
-rw-r--r--util-src/pposix.c4
-rw-r--r--util-src/ringbuffer.c4
-rw-r--r--util-src/table.c2
6 files changed, 11 insertions, 8 deletions
diff --git a/plugins/mod_blocklist.lua b/plugins/mod_blocklist.lua
index 283d52fa..6a555a06 100644
--- a/plugins/mod_blocklist.lua
+++ b/plugins/mod_blocklist.lua
@@ -228,8 +228,11 @@ end);
-- Buggy clients
module:hook("iq-error/self/blocklist-push", function (event)
+ local origin, stanza = event.origin, event.stanza;
local _, condition, text = event.stanza:get_error();
- (event.origin.log or module._log)("warn", "Client returned an error in response to notification from mod_%s: %s%s%s", module.name, condition, text and ": " or "", text or "");
+ local log = (origin.log or module._log);
+ log("warn", "Client returned an error in response to notification from mod_%s: %s%s%s",
+ module.name, condition, text and ": " or "", text or "");
return true;
end);
diff --git a/util-src/crand.c b/util-src/crand.c
index ef9da4d2..d4b84327 100644
--- a/util-src/crand.c
+++ b/util-src/crand.c
@@ -100,7 +100,7 @@ int luaopen_util_crand(lua_State *L) {
luaL_checkversion(L);
#endif
- lua_newtable(L);
+ lua_createtable(L, 0, 2);
lua_pushcfunction(L, Lrandom);
lua_setfield(L, -2, "bytes");
diff --git a/util-src/net.c b/util-src/net.c
index 35f2c362..bb159d57 100644
--- a/util-src/net.c
+++ b/util-src/net.c
@@ -134,7 +134,7 @@ int luaopen_util_net(lua_State *L) {
{ NULL, NULL }
};
- lua_newtable(L);
+ lua_createtable(L, 0, 1);
luaL_setfuncs(L, exports, 0);
return 1;
}
diff --git a/util-src/pposix.c b/util-src/pposix.c
index c0cced5c..4b4552f5 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -660,7 +660,7 @@ int lc_uname(lua_State *L) {
return 2;
}
- lua_newtable(L);
+ lua_createtable(L, 0, 6);
lua_pushstring(L, uname_info.sysname);
lua_setfield(L, -2, "sysname");
lua_pushstring(L, uname_info.nodename);
@@ -709,7 +709,7 @@ int lc_setenv(lua_State *L) {
#ifdef WITH_MALLINFO
int lc_meminfo(lua_State *L) {
struct mallinfo info = mallinfo();
- lua_newtable(L);
+ lua_createtable(L, 0, 5);
/* This is the total size of memory allocated with sbrk by malloc, in bytes. */
lua_pushinteger(L, info.arena);
lua_setfield(L, -2, "allocated");
diff --git a/util-src/ringbuffer.c b/util-src/ringbuffer.c
index 2a13903c..8d9e49e6 100644
--- a/util-src/ringbuffer.c
+++ b/util-src/ringbuffer.c
@@ -187,7 +187,7 @@ int luaopen_util_ringbuffer(lua_State *L) {
lua_pushcfunction(L, rb_length);
lua_setfield(L, -2, "__len");
- lua_newtable(L); /* __index */
+ lua_createtable(L, 0, 7); /* __index */
{
lua_pushcfunction(L, rb_find);
lua_setfield(L, -2, "find");
@@ -207,7 +207,7 @@ int luaopen_util_ringbuffer(lua_State *L) {
lua_setfield(L, -2, "__index");
}
- lua_newtable(L);
+ lua_createtable(L, 0, 1);
lua_pushcfunction(L, rb_new);
lua_setfield(L, -2, "new");
return 1;
diff --git a/util-src/table.c b/util-src/table.c
index f1cd9e12..9a9553fc 100644
--- a/util-src/table.c
+++ b/util-src/table.c
@@ -24,7 +24,7 @@ int luaopen_util_table(lua_State *L) {
#if (LUA_VERSION_NUM > 501)
luaL_checkversion(L);
#endif
- lua_newtable(L);
+ lua_createtable(L, 0, 2);
lua_pushcfunction(L, Lcreate_table);
lua_setfield(L, -2, "create");
lua_pushcfunction(L, Lpack);