From: Rainer Jung Date: Tue, 22 Jul 2014 11:57:06 +0000 (+0000) Subject: Switch from lua_objlen() to Lua 5.2 preferred X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a0f7338a21bce1feda5c0a7f9f3339f85d393e5;p=thirdparty%2Fapache%2Fhttpd.git Switch from lua_objlen() to Lua 5.2 preferred lua_rawlen(). Define lua_rawlen() in terms of lua_objlen() when building against older Lua. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1612552 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c index ff3d43436d7..4f9dca8ff1c 100644 --- a/modules/lua/lua_request.c +++ b/modules/lua/lua_request.c @@ -149,7 +149,7 @@ static int req_aprtable2luatable_cb(void *l, const char *key, } case LUA_TTABLE:{ /* [array, table, table] */ - int size = lua_objlen(L, -1); + int size = lua_rawlen(L, -1); lua_pushnumber(L, size + 1); /* [#, array, table, table] */ lua_pushstring(L, value); /* [string, #, array, table, table] */ lua_settable(L, -3); /* [array, table, table] */ @@ -198,7 +198,7 @@ static int req_aprtable2luatable_cb_len(void *l, const char *key, } case LUA_TTABLE:{ /* [array, table, table] */ - int size = lua_objlen(L, -1); + int size = lua_rawlen(L, -1); lua_pushnumber(L, size + 1); /* [#, array, table, table] */ lua_pushlstring(L, value, len); /* [string, #, array, table, table] */ lua_settable(L, -3); /* [array, table, table] */ diff --git a/modules/lua/mod_lua.h b/modules/lua/mod_lua.h index 5b422ed54ac..d3cf2e9c7c9 100644 --- a/modules/lua/mod_lua.h +++ b/modules/lua/mod_lua.h @@ -52,6 +52,8 @@ /* Load mode for lua_load() */ #define lua_load(a,b,c,d) lua_load(a,b,c,d,NULL) #define lua_resume(a,b) lua_resume(a, NULL, b) +#else +#define lua_rawlen(L,i) lua_objlen(L, (i)) #endif /* Create a set of AP_LUA_DECLARE(type), AP_LUA_DECLARE_NONSTD(type) and