From a6a102f9d8705c872dbdc8efae0fc9bb03b9114d Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Wed, 1 Feb 2012 13:17:46 +0000 Subject: [PATCH] Improve Lua 5.2.0 compatibility. This is not yet complete. Building should still work with Lua 5.1.4, but needs -DLUA_COMPAT_ALL in CPPFLAGS when compiled against 5.2.0. Automatically handling this in configure is still a TODO. Backport from trunk of the following revisions: r1221205: Make mod_lua compile with lua 5.2.x. MOdified patch submitted by NormW (nornw gknw net). r1239029: luaL_reg was already deprecated in Lua 5.1.4. It is gone in Lua 5.2.0 and was replaced by luaL_Reg which already existed in 5.1.4. So use that one. r1239030: Remove luaL_reg macro definition no longer needed and simplify lua_load compatibility macro. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1239120 13f79535-47bb-0310-9956-ffa450edef68 --- modules/lua/NWGNUmakefile | 1 + modules/lua/lua_apr.c | 2 +- modules/lua/mod_lua.h | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/lua/NWGNUmakefile b/modules/lua/NWGNUmakefile index dcff6679c4..36d0a699b4 100644 --- a/modules/lua/NWGNUmakefile +++ b/modules/lua/NWGNUmakefile @@ -44,6 +44,7 @@ XCFLAGS += \ # These defines will come after DEFINES # XDEFINES += \ + -DLUA_COMPAT_ALL \ $(EOLIST) # diff --git a/modules/lua/lua_apr.c b/modules/lua/lua_apr.c index ad396e66f5..c93ea9b1e1 100644 --- a/modules/lua/lua_apr.c +++ b/modules/lua/lua_apr.c @@ -65,7 +65,7 @@ static int lua_table_get(lua_State *L) return 1; } -static const luaL_reg lua_table_methods[] = { +static const luaL_Reg lua_table_methods[] = { {"set", lua_table_set}, {"get", lua_table_get}, {0, 0} diff --git a/modules/lua/mod_lua.h b/modules/lua/mod_lua.h index 16627240eb..5394f7a485 100644 --- a/modules/lua/mod_lua.h +++ b/modules/lua/mod_lua.h @@ -44,6 +44,11 @@ #include "lauxlib.h" #include "lualib.h" +#if LUA_VERSION_NUM > 501 +/* Load mode for lua_load() */ +#define lua_load(a,b,c,d) lua_load(a,b,c,d,NULL) +#endif + /* Create a set of AP_LUA_DECLARE(type), AP_LUA_DECLARE_NONSTD(type) and * AP_LUA_DECLARE_DATA with appropriate export and import tags for the platform */ -- 2.40.0