aboutsummaryrefslogtreecommitdiffstats
path: root/util-src
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-04-26 12:38:37 +0200
committerKim Alvefur <zash@zash.se>2015-04-26 12:38:37 +0200
commit85a8a667444d69fcf5e3cfaf0071641e50b73f2b (patch)
tree48f9ee8f36121df679a3ab395e433e2a8b994c3d /util-src
parentadb484391f938794a0d9a7913a50d88d5d2030ff (diff)
downloadprosody-85a8a667444d69fcf5e3cfaf0071641e50b73f2b.tar.gz
prosody-85a8a667444d69fcf5e3cfaf0071641e50b73f2b.zip
util-src/*.c: Invert Lua 5.2 compat to be 5.2+ by default and a macro to support 5.1
Diffstat (limited to 'util-src')
-rw-r--r--util-src/encodings.c12
-rw-r--r--util-src/hashes.c6
-rw-r--r--util-src/net.c6
-rw-r--r--util-src/pposix.c6
-rw-r--r--util-src/signal.c6
-rw-r--r--util-src/windows.c6
6 files changed, 21 insertions, 21 deletions
diff --git a/util-src/encodings.c b/util-src/encodings.c
index c00b2267..35677095 100644
--- a/util-src/encodings.c
+++ b/util-src/encodings.c
@@ -21,8 +21,8 @@
#include "lua.h"
#include "lauxlib.h"
-#if (LUA_VERSION_NUM == 502)
-#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#if (LUA_VERSION_NUM == 501)
+#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
#endif
/***************** BASE64 *****************/
@@ -530,19 +530,19 @@ LUALIB_API int luaopen_util_encodings(lua_State* L) {
lua_newtable(L);
lua_newtable(L);
- luaL_register(L, NULL, Reg_base64);
+ luaL_setfuncs(L, Reg_base64, 0);
lua_setfield(L, -2, "base64");
lua_newtable(L);
- luaL_register(L, NULL, Reg_stringprep);
+ luaL_setfuncs(L, Reg_stringprep, 0);
lua_setfield(L, -2, "stringprep");
lua_newtable(L);
- luaL_register(L, NULL, Reg_idna);
+ luaL_setfuncs(L, Reg_idna, 0);
lua_setfield(L, -2, "idna");
lua_newtable(L);
- luaL_register(L, NULL, Reg_utf8);
+ luaL_setfuncs(L, Reg_utf8, 0);
lua_setfield(L, -2, "utf8");
lua_pushliteral(L, "-3.14");
diff --git a/util-src/hashes.c b/util-src/hashes.c
index a58a424d..ecab2e32 100644
--- a/util-src/hashes.c
+++ b/util-src/hashes.c
@@ -27,8 +27,8 @@ typedef unsigned __int32 uint32_t;
#include <openssl/sha.h>
#include <openssl/md5.h>
-#if (LUA_VERSION_NUM == 502)
-#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#if (LUA_VERSION_NUM == 501)
+#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
#endif
#define HMAC_IPAD 0x36363636
@@ -213,7 +213,7 @@ static const luaL_Reg Reg[] = {
LUALIB_API int luaopen_util_hashes(lua_State* L) {
lua_newtable(L);
- luaL_register(L, NULL, Reg);
+ luaL_setfuncs(L, Reg, 0);;
lua_pushliteral(L, "-3.14");
lua_setfield(L, -2, "version");
return 1;
diff --git a/util-src/net.c b/util-src/net.c
index ad09d041..3ccc7618 100644
--- a/util-src/net.c
+++ b/util-src/net.c
@@ -26,8 +26,8 @@
#include <lua.h>
#include <lauxlib.h>
-#if (LUA_VERSION_NUM == 502)
-#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#if (LUA_VERSION_NUM == 501)
+#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
#endif
/* Enumerate all locally configured IP addresses */
@@ -131,6 +131,6 @@ int luaopen_util_net(lua_State* L) {
};
lua_newtable(L);
- luaL_register(L, NULL, exports);
+ luaL_setfuncs(L, exports, 0);
return 1;
}
diff --git a/util-src/pposix.c b/util-src/pposix.c
index 5288b08c..02ea0087 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -35,8 +35,8 @@
#include "lualib.h"
#include "lauxlib.h"
-#if (LUA_VERSION_NUM == 502)
-#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#if (LUA_VERSION_NUM == 501)
+#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
#endif
#include <fcntl.h>
@@ -803,7 +803,7 @@ int luaopen_util_pposix(lua_State* L) {
};
lua_newtable(L);
- luaL_register(L, NULL, exports);
+ luaL_setfuncs(L, exports, 0);
lua_pushliteral(L, "pposix");
lua_setfield(L, -2, "_NAME");
diff --git a/util-src/signal.c b/util-src/signal.c
index 1e988a2c..725555fa 100644
--- a/util-src/signal.c
+++ b/util-src/signal.c
@@ -32,8 +32,8 @@
#include "lua.h"
#include "lauxlib.h"
-#if (LUA_VERSION_NUM == 502)
-#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#if (LUA_VERSION_NUM == 501)
+#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
#endif
#ifndef lsig
@@ -388,7 +388,7 @@ int luaopen_util_signal(lua_State* L) {
/* add the library */
lua_newtable(L);
- luaL_register(L, NULL, lsignal_lib);
+ luaL_setfuncs(L, lsignal_lib, 0);
/* 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 aaa07407..4fcbf21e 100644
--- a/util-src/windows.c
+++ b/util-src/windows.c
@@ -19,8 +19,8 @@
#include "lua.h"
#include "lauxlib.h"
-#if (LUA_VERSION_NUM == 502)
-#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#if (LUA_VERSION_NUM == 501)
+#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
#endif
static int Lget_nameservers(lua_State* L) {
@@ -104,7 +104,7 @@ static const luaL_Reg Reg[] = {
LUALIB_API int luaopen_util_windows(lua_State* L) {
lua_newtable(L);
- luaL_register(L, NULL, Reg);
+ luaL_setfuncs(L, Reg, 0);
lua_pushliteral(L, "-3.14");
lua_setfield(L, -2, "version");
return 1;