luci-lib-nixio: allow building with Lua5.2/LuaJIT 3676/head
authorManuel BACHMANN <tarnyko@tarnyko.net>
Mon, 24 Feb 2020 10:04:54 +0000 (11:04 +0100)
committerManuel BACHMANN <tarnyko@tarnyko.net>
Mon, 24 Feb 2020 10:04:54 +0000 (11:04 +0100)
Lua 5.1 defines a "luaL_Reg" alias for deprecated
"luaL_reg", but Lua >= 5.2 and LuaJIT do not.
Replace by "luaL_Reg", and define a "luaL_reg"
alias in case we build with old Lua 5.0.

Signed-off-by: Manuel BACHMANN <tarnyko@tarnyko.net>
20 files changed:
libs/luci-lib-nixio/src/address.c
libs/luci-lib-nixio/src/binary.c
libs/luci-lib-nixio/src/bind.c
libs/luci-lib-nixio/src/bit.c
libs/luci-lib-nixio/src/file.c
libs/luci-lib-nixio/src/fs.c
libs/luci-lib-nixio/src/io.c
libs/luci-lib-nixio/src/nixio.c
libs/luci-lib-nixio/src/nixio.h
libs/luci-lib-nixio/src/poll.c
libs/luci-lib-nixio/src/process.c
libs/luci-lib-nixio/src/protoent.c
libs/luci-lib-nixio/src/socket.c
libs/luci-lib-nixio/src/sockopt.c
libs/luci-lib-nixio/src/splice.c
libs/luci-lib-nixio/src/syslog.c
libs/luci-lib-nixio/src/tls-context.c
libs/luci-lib-nixio/src/tls-crypto.c
libs/luci-lib-nixio/src/tls-socket.c
libs/luci-lib-nixio/src/user.c

index 7957e8cc19aafa49bc220d3078b61500f452ce5d..0bf53caf82cee3c1211b8ae911f5e2d3c45c81f7 100644 (file)
@@ -544,7 +544,7 @@ static int nixio_getifaddrs(lua_State *L) {
 
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
 #if defined(__linux__) || defined(BSD)
        {"getifaddrs",  nixio_getifaddrs},
 #endif
@@ -554,7 +554,7 @@ static const luaL_reg R[] = {
 };
 
 /* object table */
-static const luaL_reg M[] = {
+static const luaL_Reg M[] = {
        {"getsockname", nixio_sock_getsockname},
        {"getpeername", nixio_sock_getpeername},
        {NULL,                  NULL}
index 2c41622280f0d706648c585a92fc816532ee5fa7..da794536ce79653d2f3707d7527471bc2102200c 100644 (file)
@@ -296,7 +296,7 @@ static int nixio_bin_b64decode(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"hexlify",             nixio_bin_hexlify},
        {"unhexlify",   nixio_bin_unhexlify},
        {"crc32",               nixio_bin_crc32},
index 68e1df8a8c30af03b8fc04cf5c4304c62db261a5..664d3e063422a38f65f8357b912966473214c586 100644 (file)
@@ -269,14 +269,14 @@ static int nixio_sock_accept(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"bind",                nixio_bind},
        {"connect",             nixio_connect},
        {NULL,                  NULL}
 };
 
 /* object table */
-static const luaL_reg M[] = {
+static const luaL_Reg M[] = {
        {"bind",                nixio_sock_bind},
        {"connect",             nixio_sock_connect},
        {"listen",              nixio_sock_listen},
index 1b352c51c5438c4a92fb2c3b643c970563ecfb4b..8c3c1b79800fa2e940850bf638daae7fca65d503 100644 (file)
@@ -120,7 +120,7 @@ static int nixio_bit_swap(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"bor",                 nixio_bit_or},
        {"set",                 nixio_bit_or},
        {"band",                nixio_bit_and},
index cfa35dfd17470b309f5ae050910f57734b5a15e7..91468a258a1888dd26e8125622daeeba60ba5241 100644 (file)
@@ -379,7 +379,7 @@ static int nixio_file__tostring(lua_State *L) {
 }
 
 /* method table */
-static const luaL_reg M[] = {
+static const luaL_Reg M[] = {
        {"write",               nixio_file_write},
        {"read",                nixio_file_read},
        {"tell",                nixio_file_tell},
@@ -394,7 +394,7 @@ static const luaL_reg M[] = {
 };
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"dup",                 nixio_dup},
        {"open",                nixio_open},
        {"open_flags",  nixio_open_flags},
index ba184ed1192cf284f818a64b0acc60ce1f9e5ad6..28c675a10644e975dd4bbc22b3bdece50c433305 100644 (file)
@@ -519,7 +519,7 @@ static int nixio_statvfs(lua_State *L) {
 
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
 #ifndef __WINNT__
        {"glob",                nixio_glob},
        {"mkfifo",              nixio_mkfifo},
index 12d5c7df4529661b9869ebbd0e514a255e5d6331..a3b800e99631f2af5ba2b1ca1fc947fae8cb9e0b 100644 (file)
@@ -208,7 +208,7 @@ static int nixio_sock_recvfrom(lua_State *L) {
 
 
 /* module table */
-static const luaL_reg M[] = {
+static const luaL_Reg M[] = {
        {"send",        nixio_sock_send},
        {"sendto",      nixio_sock_sendto},
        {"recv",        nixio_sock_recv},
index ae81c6f96435ce2eb4dbc89235a8108701509773..bb0a3270b58ac8b17fa24d91c332244fe8767dca 100644 (file)
@@ -102,7 +102,7 @@ static int nixio_strerror(lua_State *L) {
 }
 
 /* object table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"errno",               nixio_errno},
        {"strerror",    nixio_strerror},
        {NULL,                  NULL}
index 8802e920431af6665878dd184bd8435fef7bf080..5eb84d11ae34f6340c26e3886d37a8b4c315da20 100644 (file)
 #include <lauxlib.h>
 #include <luaconf.h>
 
+#if LUA_VERSION_NUM < 501
+#define luaL_Reg luaL_reg
+#endif
+
 #define NIXIO_BUFFERSIZE 8192
 
 typedef struct nixio_socket {
index 1211bc72ac392471a70586d10a2c4279773f6f07..b013303ebd26ac97181734aad851e8a4e2301966 100644 (file)
@@ -197,7 +197,7 @@ static int nixio_poll(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"gettimeofday", nixio_gettimeofday},
        {"nanosleep",   nixio_nanosleep},
        {"poll",                nixio_poll},
index 5ae9b829ea57b4fb9729261f34bb7c83e48f2fea..c7b52769b67a302778e3355cd7940a85e273694d 100644 (file)
@@ -412,7 +412,7 @@ static int nixio_sysinfo(lua_State *L) {
 
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
 #ifdef __linux__
        {"sysinfo",             nixio_sysinfo},
 #endif
index bda68a58453e0d35dcb22259875249f28be8d401..e74b155b4f012c57922c74fb55676a07c4a8c20b 100644 (file)
@@ -91,7 +91,7 @@ static int nixio_getproto(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
     {"getprotobyname",         nixio_getprotobyname},
     {"getprotobynumber",       nixio_getprotobynumber},
     {"getproto",                       nixio_getproto},
index 17c6afc7900a4b71bcf305050efd11572fc247d0..b4b052eaa0b1f1741946314392fd98bbc5b18727 100644 (file)
@@ -150,13 +150,13 @@ static int nixio_sock_shutdown(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"socket",              nixio_socket},
        {NULL,                  NULL}
 };
 
 /* object table */
-static const luaL_reg M[] = {
+static const luaL_Reg M[] = {
        {"close",               nixio_sock_close},
        {"shutdown",    nixio_sock_shutdown},
        {"__gc",                nixio_sock__gc},
index cede884ce4616d7748c16a4613a2b4aa31eb8a1f..7b6f0488b6b8a1894ac6febf6fc98621fecc250c 100644 (file)
@@ -366,7 +366,7 @@ static int nixio_sock_setsockopt(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg M[] = {
+static const luaL_Reg M[] = {
        {"setblocking", nixio_sock_setblocking},
        {"getsockopt",  nixio_sock_getsockopt},
        {"setsockopt",  nixio_sock_setsockopt},
index db63ea9a896c8ed5ed5d2e94b75810c11aaccadd..7b6095a7be7f97924fe97d79f7c16da85f0116df 100644 (file)
@@ -161,7 +161,7 @@ static int nixio_sendfile(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
 #ifdef _GNU_SOURCE
 #ifdef SPLICE_F_MOVE
        {"splice",                      nixio_splice},
index 89f1b1dda1d9b239c753ca63e44e2e1d7ea5a914..5ea181b74a2aa120f08df75a23b97a65432ddf3a 100644 (file)
@@ -102,7 +102,7 @@ static int nixio_syslog(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"openlog",             nixio_openlog},
        {"syslog",              nixio_syslog},
        {"setlogmask",  nixio_setlogmask},
index e9a833f59065de0c3f3babf66fbebfddc764eb3e..29b1c8bd004bd9880a54bd486e53ccbdb08f3c08 100644 (file)
@@ -203,13 +203,13 @@ static int nixio_tls_ctx__tostring(lua_State *L) {
 }
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"tls",         nixio_tls_ctx},
        {NULL,                  NULL}
 };
 
 /* ctx function table */
-static const luaL_reg CTX_M[] = {
+static const luaL_Reg CTX_M[] = {
        {"set_cert",                    nixio_tls_ctx_set_cert},
        {"set_verify_locations",       nixio_tls_ctx_set_verify_locations},
        {"set_key",                             nixio_tls_ctx_set_key},
index 714ec4e60c3fb4a0ae0f022d98e30fb13ce2b00e..1d4945c8c847104859a7e820ab34442a6f07649e 100644 (file)
@@ -154,14 +154,14 @@ static int nixio_crypto_hash__tostring(lua_State *L) {
 
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"hash",                nixio_crypto_hash},
        {"hmac",                nixio_crypto_hmac},
        {NULL,                  NULL}
 };
 
 /* hash table */
-static const luaL_reg M[] = {
+static const luaL_Reg M[] = {
        {"update",              nixio_crypto_hash_update},
        {"final",               nixio_crypto_hash_final},
        {"__gc",                nixio_crypto_hash__gc},
index fe4cb60755c8eb2749d65116028997833ea6c098..122f598e0a09cec929a3c7586093a94c80f26ea1 100644 (file)
@@ -239,7 +239,7 @@ static int nixio_tls_sock__tostring(lua_State *L) {
 
 
 /* ctx function table */
-static const luaL_reg M[] = {
+static const luaL_Reg M[] = {
        {"recv",                nixio_tls_sock_recv},
        {"send",                nixio_tls_sock_send},
        {"read",                nixio_tls_sock_recv},
index b701bac95504c6f5a25128c80f26f1fe14deaa2b..b4f5ea1d53ea0a67e1941cf47260c6f37ed0a89d 100644 (file)
@@ -238,7 +238,7 @@ static int nixio_crypt(lua_State *L) {
 
 
 /* module table */
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
        {"crypt",               nixio_crypt},
        {"getgr",               nixio_getgr},
        {"getpw",               nixio_getpw},
@@ -252,7 +252,7 @@ static const luaL_reg R[] = {
 
 #else /* __WINNT__ */
 
-static const luaL_reg R[] = {
+static const luaL_Reg R[] = {
                {NULL,                  NULL}
 };