aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2014-09-16 21:56:18 +0200
committerKim Alvefur <zash@zash.se>2014-09-16 21:56:18 +0200
commitbcab7a928a24ff7da693c6c8370ab18ae19284bd (patch)
tree7a2f8f679b522db52d967a34eb806b8f73ba59c4
parentf41908a42c7e4f8397b52536e5e32c771b07a096 (diff)
downloadprosody-bcab7a928a24ff7da693c6c8370ab18ae19284bd.tar.gz
prosody-bcab7a928a24ff7da693c6c8370ab18ae19284bd.zip
util-src/*.c: Don't create globals when loaded
-rw-r--r--util-src/encodings.c7
-rw-r--r--util-src/hashes.c3
-rw-r--r--util-src/net.c3
-rw-r--r--util-src/pposix.c3
-rw-r--r--util-src/signal.c3
-rw-r--r--util-src/windows.c3
6 files changed, 11 insertions, 11 deletions
diff --git a/util-src/encodings.c b/util-src/encodings.c
index b9b6160a..3a074949 100644
--- a/util-src/encodings.c
+++ b/util-src/encodings.c
@@ -361,17 +361,12 @@ static const luaL_Reg Reg_idna[] =
/***************** end *****************/
-static const luaL_Reg Reg[] =
-{
- { NULL, NULL }
-};
-
LUALIB_API int luaopen_util_encodings(lua_State *L)
{
#ifdef USE_STRINGPREP_ICU
init_icu();
#endif
- luaL_register(L, "encodings", Reg);
+ lua_newtable(L);
lua_pushliteral(L, "base64");
lua_newtable(L);
diff --git a/util-src/hashes.c b/util-src/hashes.c
index 33041e83..7ca00867 100644
--- a/util-src/hashes.c
+++ b/util-src/hashes.c
@@ -203,7 +203,8 @@ static const luaL_Reg Reg[] =
LUALIB_API int luaopen_util_hashes(lua_State *L)
{
- luaL_register(L, "hashes", Reg);
+ lua_newtable(L);
+ luaL_register(L, NULL, Reg);
lua_pushliteral(L, "version"); /** version */
lua_pushliteral(L, "-3.14");
lua_settable(L,-3);
diff --git a/util-src/net.c b/util-src/net.c
index e307c628..84d7e84e 100644
--- a/util-src/net.c
+++ b/util-src/net.c
@@ -112,6 +112,7 @@ int luaopen_util_net(lua_State* L)
{ NULL, NULL }
};
- luaL_register(L, "net", exports);
+ lua_newtable(L);
+ luaL_register(L, NULL, exports);
return 1;
}
diff --git a/util-src/pposix.c b/util-src/pposix.c
index 9b3e97eb..62bd0339 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -768,7 +768,8 @@ int luaopen_util_pposix(lua_State *L)
{ NULL, NULL }
};
- luaL_register(L, "pposix", exports);
+ lua_newtable(L);
+ luaL_register(L, NULL, exports);
lua_pushliteral(L, "pposix");
lua_setfield(L, -2, "_NAME");
diff --git a/util-src/signal.c b/util-src/signal.c
index 961d2d3e..405689f5 100644
--- a/util-src/signal.c
+++ b/util-src/signal.c
@@ -384,7 +384,8 @@ int luaopen_util_signal(lua_State *L)
int i = 0;
/* add the library */
- luaL_register(L, "signal", lsignal_lib);
+ lua_newtable(L);
+ luaL_register(L, NULL, lsignal_lib);
/* push lua_signals table into the registry */
/* put the signals inside the library table too,
diff --git a/util-src/windows.c b/util-src/windows.c
index 3d14ca95..9b79c662 100644
--- a/util-src/windows.c
+++ b/util-src/windows.c
@@ -81,7 +81,8 @@ static const luaL_Reg Reg[] =
};
LUALIB_API int luaopen_util_windows(lua_State *L) {
- luaL_register(L, "windows", Reg);
+ lua_newtable(L);
+ luaL_register(L, NULL, Reg);
lua_pushliteral(L, "version"); /** version */
lua_pushliteral(L, "-3.14");
lua_settable(L,-3);