From: Rainer Jung Date: Wed, 1 Feb 2012 13:17:46 +0000 (+0000) Subject: Improve Lua 5.2.0 compatibility. X-Git-Tag: 2.4.1~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6a102f9d8705c872dbdc8efae0fc9bb03b9114d;p=apache 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 --- 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 */