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
commitc57e98cd7debd8d8ea46159cbbf2eb7597544d4c (patch)
tree7a2f8f679b522db52d967a34eb806b8f73ba59c4
parenta685dfb89e5c8895a767011961d2289810b72a1e (diff)
downloadprosody-c57e98cd7debd8d8ea46159cbbf2eb7597544d4c.tar.gz
prosody-c57e98cd7debd8d8ea46159cbbf2eb7597544d4c.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);