diff options
author | Kim Alvefur <zash@zash.se> | 2014-09-17 02:23:17 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-09-17 02:23:17 +0200 |
commit | 110fb5576b604fdff69dd7d6cedeec4fee7fe361 (patch) | |
tree | cc0d784c48dd70d272897cbf4cc39ceed6c3479e | |
parent | bcab7a928a24ff7da693c6c8370ab18ae19284bd (diff) | |
download | prosody-110fb5576b604fdff69dd7d6cedeec4fee7fe361.tar.gz prosody-110fb5576b604fdff69dd7d6cedeec4fee7fe361.zip |
util-src/*.c: Use the more concise lua_setfield
-rw-r--r-- | util-src/encodings.c | 12 | ||||
-rw-r--r-- | util-src/hashes.c | 3 | ||||
-rw-r--r-- | util-src/signal.c | 2 | ||||
-rw-r--r-- | util-src/windows.c | 3 |
4 files changed, 7 insertions, 13 deletions
diff --git a/util-src/encodings.c b/util-src/encodings.c index 3a074949..fb838551 100644 --- a/util-src/encodings.c +++ b/util-src/encodings.c @@ -368,23 +368,19 @@ LUALIB_API int luaopen_util_encodings(lua_State *L) #endif lua_newtable(L); - lua_pushliteral(L, "base64"); lua_newtable(L); luaL_register(L, NULL, Reg_base64); - lua_settable(L,-3); + lua_setfield(L, -2, "base64"); - lua_pushliteral(L, "stringprep"); lua_newtable(L); luaL_register(L, NULL, Reg_stringprep); - lua_settable(L,-3); + lua_setfield(L, -2, "stringprep"); - lua_pushliteral(L, "idna"); lua_newtable(L); luaL_register(L, NULL, Reg_idna); - lua_settable(L,-3); + lua_setfield(L, -2, "idna"); - lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, "-3.14"); - lua_settable(L,-3); + lua_setfield(L, -2, "version"); return 1; } diff --git a/util-src/hashes.c b/util-src/hashes.c index 7ca00867..39ab5180 100644 --- a/util-src/hashes.c +++ b/util-src/hashes.c @@ -205,8 +205,7 @@ LUALIB_API int luaopen_util_hashes(lua_State *L) { lua_newtable(L); luaL_register(L, NULL, Reg); - lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, "-3.14"); - lua_settable(L,-3); + lua_setfield(L, -2, "version"); return 1; } diff --git a/util-src/signal.c b/util-src/signal.c index 405689f5..3d0a8a50 100644 --- a/util-src/signal.c +++ b/util-src/signal.c @@ -391,7 +391,7 @@ int luaopen_util_signal(lua_State *L) /* put the signals inside the library table too, * they are only a reference */ lua_pushstring(L, LUA_SIGNAL); - lua_createtable(L, 0, 0); + lua_newtable(L); while (lua_signals[i].name != NULL) { diff --git a/util-src/windows.c b/util-src/windows.c index 9b79c662..a209539f 100644 --- a/util-src/windows.c +++ b/util-src/windows.c @@ -83,8 +83,7 @@ static const luaL_Reg Reg[] = LUALIB_API int luaopen_util_windows(lua_State *L) { lua_newtable(L); luaL_register(L, NULL, Reg); - lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, "-3.14"); - lua_settable(L,-3); + lua_setfield(L, -2, "version"); return 1; } |