util-src/*.c: Add macro for compiling with Lua 5.2
authorKim Alvefur <zash@zash.se>
Wed, 17 Sep 2014 14:30:29 +0200
changeset 6416 a552f4170aed
parent 6415 0e94f89d0e62
child 6417 31c15004bfb0
util-src/*.c: Add macro for compiling with Lua 5.2
util-src/encodings.c
util-src/hashes.c
util-src/net.c
util-src/pposix.c
util-src/signal.c
util-src/windows.c
--- a/util-src/encodings.c	Wed Sep 17 02:23:17 2014 +0200
+++ b/util-src/encodings.c	Wed Sep 17 14:30:29 2014 +0200
@@ -20,6 +20,10 @@
 #include "lua.h"
 #include "lauxlib.h"
 
+#if (LUA_VERSION_NUM == 502)
+#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#endif
+
 /***************** BASE64 *****************/
 
 static const char code[]=
--- a/util-src/hashes.c	Wed Sep 17 02:23:17 2014 +0200
+++ b/util-src/hashes.c	Wed Sep 17 14:30:29 2014 +0200
@@ -27,6 +27,10 @@
 #include <openssl/sha.h>
 #include <openssl/md5.h>
 
+#if (LUA_VERSION_NUM == 502)
+#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#endif
+
 #define HMAC_IPAD 0x36363636
 #define HMAC_OPAD 0x5c5c5c5c
 
--- a/util-src/net.c	Wed Sep 17 02:23:17 2014 +0200
+++ b/util-src/net.c	Wed Sep 17 14:30:29 2014 +0200
@@ -26,6 +26,10 @@
 #include <lua.h>
 #include <lauxlib.h>
 
+#if (LUA_VERSION_NUM == 502)
+#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#endif
+
 /* Enumerate all locally configured IP addresses */
 
 const char * const type_strings[] = {
--- a/util-src/pposix.c	Wed Sep 17 02:23:17 2014 +0200
+++ b/util-src/pposix.c	Wed Sep 17 14:30:29 2014 +0200
@@ -35,6 +35,10 @@
 #include "lualib.h"
 #include "lauxlib.h"
 
+#if (LUA_VERSION_NUM == 502)
+#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#endif
+
 #include <fcntl.h>
 #if defined(__linux__) && defined(_GNU_SOURCE)
 #include <linux/falloc.h>
--- a/util-src/signal.c	Wed Sep 17 02:23:17 2014 +0200
+++ b/util-src/signal.c	Wed Sep 17 14:30:29 2014 +0200
@@ -32,6 +32,10 @@
 #include "lua.h"
 #include "lauxlib.h"
 
+#if (LUA_VERSION_NUM == 502)
+#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#endif
+
 #ifndef lsig
 
 #define lsig
--- a/util-src/windows.c	Wed Sep 17 02:23:17 2014 +0200
+++ b/util-src/windows.c	Wed Sep 17 14:30:29 2014 +0200
@@ -19,6 +19,10 @@
 #include "lua.h"
 #include "lauxlib.h"
 
+#if (LUA_VERSION_NUM == 502)
+#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0)
+#endif
+
 static int Lget_nameservers(lua_State *L) {
 	char stack_buffer[1024]; // stack allocated buffer
 	IP4_ARRAY* ips = (IP4_ARRAY*) stack_buffer;