diff options
author | obache <obache@pkgsrc.org> | 2013-10-30 10:36:12 +0000 |
---|---|---|
committer | obache <obache@pkgsrc.org> | 2013-10-30 10:36:12 +0000 |
commit | 287f8925aba44e9583863834d3e16afe2dd45317 (patch) | |
tree | e6233ad999d9fd437b71c79f2402918651ad43be /databases/lua-tokyocabinet | |
parent | b045c5408252db42c74f9483a4850810ffcfc5cb (diff) | |
download | pkgsrc-287f8925aba44e9583863834d3e16afe2dd45317.tar.gz |
Let to be buildable with lua-5.1 too.
Diffstat (limited to 'databases/lua-tokyocabinet')
-rw-r--r-- | databases/lua-tokyocabinet/distinfo | 4 | ||||
-rw-r--r-- | databases/lua-tokyocabinet/patches/patch-tokyocabinet.c | 110 |
2 files changed, 16 insertions, 98 deletions
diff --git a/databases/lua-tokyocabinet/distinfo b/databases/lua-tokyocabinet/distinfo index f8a629e7bc0..58b9c978cc8 100644 --- a/databases/lua-tokyocabinet/distinfo +++ b/databases/lua-tokyocabinet/distinfo @@ -1,8 +1,8 @@ -$NetBSD: distinfo,v 1.7 2013/10/27 13:01:33 obache Exp $ +$NetBSD: distinfo,v 1.8 2013/10/30 10:36:12 obache Exp $ SHA1 (tokyocabinet-lua-1.10.tar.gz) = 4f182f990b53eae3fe78f1dfba0e64cc52316bef RMD160 (tokyocabinet-lua-1.10.tar.gz) = b0cf1183d3e9b9dc07c2cd5c32be06adbe9a1187 Size (tokyocabinet-lua-1.10.tar.gz) = 111135 bytes SHA1 (patch-aa) = a02449c57d232192058c5673fbd3910220db856f SHA1 (patch-ab) = 80aadd7a2ea3caef9a6965c995f526b00b6ff64f -SHA1 (patch-tokyocabinet.c) = d03ef080a0b4e8bfeb4f4331553fd1042bf02887 +SHA1 (patch-tokyocabinet.c) = 329efb1d5529136c1bafec2164ad94a26d818b58 diff --git a/databases/lua-tokyocabinet/patches/patch-tokyocabinet.c b/databases/lua-tokyocabinet/patches/patch-tokyocabinet.c index ebcbf799094..b40c83b2f82 100644 --- a/databases/lua-tokyocabinet/patches/patch-tokyocabinet.c +++ b/databases/lua-tokyocabinet/patches/patch-tokyocabinet.c @@ -1,102 +1,20 @@ -$NetBSD: patch-tokyocabinet.c,v 1.1 2013/10/27 13:01:33 obache Exp $ +$NetBSD: patch-tokyocabinet.c,v 1.2 2013/10/30 10:36:12 obache Exp $ * Lua 5.2 API change --- tokyocabinet.c.orig 2010-09-19 23:14:07.000000000 +0000 +++ tokyocabinet.c -@@ -369,7 +369,7 @@ int luaopen_tokyocabinet(lua_State *lua) +@@ -34,6 +34,13 @@ + #include <sys/types.h> + #include <sys/stat.h> - /* convert a table of Lua into a list object of TC */ - static TCLIST *tabletotclist(lua_State *lua, int index){ -- int len = lua_objlen(lua, index); -+ int len = lua_rawlen(lua, index); - TCLIST *list = tclistnew2(len); - for(int i = 1; i <= len; i++){ - lua_rawgeti(lua, index, i); -@@ -536,7 +536,7 @@ static int util_pack(lua_State *lua){ - lua_rawseti(lua, aidx, eidx++); - break; - case LUA_TTABLE: -- len = lua_objlen(lua, i); -+ len = lua_rawlen(lua, i); - for(int j = 1; j <= len; j++){ - lua_rawgeti(lua, i, j); - lua_rawseti(lua, aidx, eidx++); -@@ -1200,7 +1200,7 @@ static int util_ucs(lua_State *lua){ - lua_error(lua); - } - if(lua_type(lua, 1) == LUA_TTABLE){ -- int anum = lua_objlen(lua, 1); -+ int anum = lua_rawlen(lua, 1); - uint16_t *ary = tcmalloc(sizeof(*ary) * anum + 1); - for(int i = 1; i <= anum; i++){ - lua_rawgeti(lua, 1, i); -@@ -1260,7 +1260,7 @@ static int util_dist(lua_State *lua){ - static int util_isect(lua_State *lua){ - int argc = lua_gettop(lua); - if(argc == 1 && lua_type(lua, 1) == LUA_TTABLE){ -- int len = lua_objlen(lua, 1); -+ int len = lua_rawlen(lua, 1); - for(int i = 1; i <= len; i++){ - lua_rawgeti(lua, 1, i); - if(lua_type(lua, -1) == LUA_TTABLE){ -@@ -1279,7 +1279,7 @@ static int util_isect(lua_State *lua){ - int rnum = 0; - for(int i = 1; i <= argc; i++){ - if(lua_type(lua, i) != LUA_TTABLE) continue; -- int len = lua_objlen(lua, i); -+ int len = lua_rawlen(lua, i); - if(len < 1){ - lua_settop(lua, 0); - lua_newtable(lua); -@@ -1293,7 +1293,7 @@ static int util_isect(lua_State *lua){ - TCMAP *latter = NULL; - for(int i = 1; i <= argc; i++){ - if(lua_type(lua, i) != LUA_TTABLE) continue; -- int len = lua_objlen(lua, i); -+ int len = lua_rawlen(lua, i); - if(former){ - latter = tcmapnew2(tclmin(len, tcmaprnum(former))); - for(int j = 1; j <= len; j++){ -@@ -1338,7 +1338,7 @@ static int util_isect(lua_State *lua){ - TCMAP *freq = tcmapnew2(rnum); - for(int i = 1; i <= argc; i++){ - if(lua_type(lua, i) != LUA_TTABLE) continue; -- int len = lua_objlen(lua, i); -+ int len = lua_rawlen(lua, i); - TCMAP *uniq = tcmapnew2(len); - for(int j = 1; j <= len; j++){ - lua_rawgeti(lua, i, j); -@@ -1379,7 +1379,7 @@ static int util_isect(lua_State *lua){ - static int util_union(lua_State *lua){ - int argc = lua_gettop(lua); - if(argc == 1 && lua_type(lua, 1) == LUA_TTABLE){ -- int len = lua_objlen(lua, 1); -+ int len = lua_rawlen(lua, 1); - for(int i = 1; i <= len; i++){ - lua_rawgeti(lua, 1, i); - if(lua_type(lua, -1) == LUA_TTABLE){ -@@ -1397,12 +1397,12 @@ static int util_union(lua_State *lua){ - int rnum = 0; - for(int i = 1; i <= argc; i++){ - if(lua_type(lua, i) != LUA_TTABLE) continue; -- rnum += lua_objlen(lua, i); -+ rnum += lua_rawlen(lua, i); - } - TCMAP *result = tcmapnew2(rnum); - for(int i = 1; i <= argc; i++){ - if(lua_type(lua, i) != LUA_TTABLE) continue; -- int len = lua_objlen(lua, i); -+ int len = lua_rawlen(lua, i); - for(int j = 1; j <= len; j++){ - lua_rawgeti(lua, i, j); - size_t size; -@@ -6400,7 +6400,7 @@ static int tdbqry_metasearch(lua_State * - lua_error(lua); - } - TDBQRY *qry = data->qry; -- int num = lua_objlen(lua, 2); -+ int num = lua_rawlen(lua, 2); - TDBQRY **qrys = tcmalloc(sizeof(*qrys) * (num + 1)); - int qnum = 0; - qrys[qnum++] = qry; ++#ifdef LUA_VERSION_NUM ++# if (LUA_VERSION_NUM >= 502) ++#undef lua_objlen ++#define lua_objlen lua_rawlen ++# endif ++#endif ++ + #define SWAB16(TC_num) \ + ( \ + ((TC_num & 0x00ffU) << 8) | \ |