aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-01-08 14:21:08 +0100
committerKim Alvefur <zash@zash.se>2017-01-08 14:21:08 +0100
commit5f26a96cc471f320b763f00f4dea785500d7ebb3 (patch)
treecc0b5c0edcee314b6909b3b18bed137ed8722358
parent311fc4e4dd37b88e78889d17d53727e0b5876685 (diff)
downloadprosody-5f26a96cc471f320b763f00f4dea785500d7ebb3.tar.gz
prosody-5f26a96cc471f320b763f00f4dea785500d7ebb3.zip
util-src: Make C modules assert that the Lua runtime matches what it was compiled for
-rw-r--r--util-src/crand.c3
-rw-r--r--util-src/encodings.c3
-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/ringbuffer.c3
-rw-r--r--util-src/signal.c3
-rw-r--r--util-src/table.c3
-rw-r--r--util-src/windows.c3
9 files changed, 27 insertions, 0 deletions
diff --git a/util-src/crand.c b/util-src/crand.c
index fbdec8f8..177511ce 100644
--- a/util-src/crand.c
+++ b/util-src/crand.c
@@ -130,6 +130,9 @@ int Lseed(lua_State *L) {
#endif
int luaopen_util_crand(lua_State *L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
lua_newtable(L);
lua_pushcfunction(L, Lrandom);
lua_setfield(L, -2, "bytes");
diff --git a/util-src/encodings.c b/util-src/encodings.c
index 35677095..6389b2be 100644
--- a/util-src/encodings.c
+++ b/util-src/encodings.c
@@ -524,6 +524,9 @@ static const luaL_Reg Reg_idna[] = {
/***************** end *****************/
LUALIB_API int luaopen_util_encodings(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
#ifdef USE_STRINGPREP_ICU
init_icu();
#endif
diff --git a/util-src/hashes.c b/util-src/hashes.c
index ecab2e32..d6f848c7 100644
--- a/util-src/hashes.c
+++ b/util-src/hashes.c
@@ -212,6 +212,9 @@ static const luaL_Reg Reg[] = {
};
LUALIB_API int luaopen_util_hashes(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
lua_newtable(L);
luaL_setfuncs(L, Reg, 0);;
lua_pushliteral(L, "-3.14");
diff --git a/util-src/net.c b/util-src/net.c
index 3ccc7618..18f3d27a 100644
--- a/util-src/net.c
+++ b/util-src/net.c
@@ -125,6 +125,9 @@ static int lc_local_addresses(lua_State* L) {
}
int luaopen_util_net(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
luaL_Reg exports[] = {
{ "local_addresses", lc_local_addresses },
{ NULL, NULL }
diff --git a/util-src/pposix.c b/util-src/pposix.c
index 7037730f..39d8742b 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -779,6 +779,9 @@ int lc_fallocate(lua_State* L) {
/* Register functions */
int luaopen_util_pposix(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
luaL_Reg exports[] = {
{ "abort", lc_abort },
diff --git a/util-src/ringbuffer.c b/util-src/ringbuffer.c
index f5fa136b..d60a43d9 100644
--- a/util-src/ringbuffer.c
+++ b/util-src/ringbuffer.c
@@ -197,6 +197,9 @@ int rb_gc(lua_State* L) {
}
int luaopen_util_ringbuffer(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
if(luaL_newmetatable(L, "ringbuffer_mt")) {
lua_pushcfunction(L, rb_tostring);
lua_setfield(L, -2, "__tostring");
diff --git a/util-src/signal.c b/util-src/signal.c
index 725555fa..3f29febb 100644
--- a/util-src/signal.c
+++ b/util-src/signal.c
@@ -384,6 +384,9 @@ static const struct luaL_Reg lsignal_lib[] = {
};
int luaopen_util_signal(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
int i = 0;
/* add the library */
diff --git a/util-src/table.c b/util-src/table.c
index 63415541..93acae65 100644
--- a/util-src/table.c
+++ b/util-src/table.c
@@ -21,6 +21,9 @@ static int Lpack(lua_State* L) {
int luaopen_util_table(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
lua_newtable(L);
lua_pushcfunction(L, Lcreate_table);
lua_setfield(L, -2, "create");
diff --git a/util-src/windows.c b/util-src/windows.c
index 4fcbf21e..e4457994 100644
--- a/util-src/windows.c
+++ b/util-src/windows.c
@@ -103,6 +103,9 @@ static const luaL_Reg Reg[] = {
};
LUALIB_API int luaopen_util_windows(lua_State* L) {
+#if (LUA_VERSION_NUM > 501)
+ luaL_checkversion(L);
+#endif
lua_newtable(L);
luaL_setfuncs(L, Reg, 0);
lua_pushliteral(L, "-3.14");