lua_objlen wrapped in luaA_rawlen

In lua 5.2 lua_objlen was renamed for now reason

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
This commit is contained in:
Arvydas Sidorenko 2012-06-07 09:27:10 +02:00 committed by Julien Danjou
parent 47e21ad3cc
commit d612b922f3
4 changed files with 13 additions and 3 deletions

View File

@ -53,7 +53,7 @@ void luaA_dumpstack(lua_State *L)
break; break;
default: default:
fprintf(stderr, "%d: %s\t#%d\t%p\n", i, lua_typename(L, t), fprintf(stderr, "%d: %s\t#%d\t%p\n", i, lua_typename(L, t),
(int) lua_objlen(L, i), (int) luaA_rawlen(L, i),
lua_topointer(L, i)); lua_topointer(L, i));
break; break;
} }

2
dbus.c
View File

@ -276,7 +276,7 @@ a_dbus_convert_value(lua_State *L, int idx, DBusMessageIter *iter)
type + 1, type + 1,
&subiter); &subiter);
int arraylen = lua_objlen(L, idx + 1); int arraylen = luaA_rawlen(L, idx + 1);
if(arraylen % 2 != 0) if(arraylen % 2 != 0)
{ {

10
luaa.h
View File

@ -94,6 +94,16 @@ luaA_setuservalue(lua_State *L, int idx)
#endif #endif
} }
static inline size_t
luaA_rawlen(lua_State *L, int idx)
{
#if LUA_VERSION_NUM >= 502
return lua_rawlen(L, idx);
#else
return lua_objlen(L, idx);
#endif
}
static inline bool static inline bool
luaA_checkboolean(lua_State *L, int n) luaA_checkboolean(lua_State *L, int n)
{ {

View File

@ -142,7 +142,7 @@ uint16_t
luaA_tomodifiers(lua_State *L, int ud) luaA_tomodifiers(lua_State *L, int ud)
{ {
luaA_checktable(L, ud); luaA_checktable(L, ud);
ssize_t len = lua_objlen(L, ud); ssize_t len = luaA_rawlen(L, ud);
uint16_t mod = XCB_NONE; uint16_t mod = XCB_NONE;
for(int i = 1; i <= len; i++) for(int i = 1; i <= len; i++)
{ {