1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

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
This commit is contained in:
Rainer Jung
2014-07-22 11:57:06 +00:00
parent a41155663a
commit 118e19314d
2 changed files with 4 additions and 2 deletions

View File

@@ -149,7 +149,7 @@ static int req_aprtable2luatable_cb(void *l, const char *key,
}
case LUA_TTABLE:{
/* [array, table<s,t>, table<s,s>] */
int size = lua_objlen(L, -1);
int size = lua_rawlen(L, -1);
lua_pushnumber(L, size + 1); /* [#, array, table<s,t>, table<s,s>] */
lua_pushstring(L, value); /* [string, #, array, table<s,t>, table<s,s>] */
lua_settable(L, -3); /* [array, table<s,t>, table<s,s>] */
@@ -198,7 +198,7 @@ static int req_aprtable2luatable_cb_len(void *l, const char *key,
}
case LUA_TTABLE:{
/* [array, table<s,t>, table<s,s>] */
int size = lua_objlen(L, -1);
int size = lua_rawlen(L, -1);
lua_pushnumber(L, size + 1); /* [#, array, table<s,t>, table<s,s>] */
lua_pushlstring(L, value, len); /* [string, #, array, table<s,t>, table<s,s>] */
lua_settable(L, -3); /* [array, table<s,t>, table<s,s>] */

View File

@@ -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