diff options
author | wiz <wiz@pkgsrc.org> | 2013-10-11 20:25:34 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2013-10-11 20:25:34 +0000 |
commit | 24f794c2971875e7d717ae4f6ff57c15c28455be (patch) | |
tree | df6b13573ec595110de90a76743cf88493a66fb6 /mail/OSBF-lua/patches/patch-losbflib.c | |
parent | 902fa41daab46a53277f882d3fd5ac56c11ea6b8 (diff) | |
download | pkgsrc-24f794c2971875e7d717ae4f6ff57c15c28455be.tar.gz |
More fixes for lua-5.2. From https://github.com/arunpersaud/osbf-lua
with the help of John R. Shannon.
Bump PKGREVISION.
Diffstat (limited to 'mail/OSBF-lua/patches/patch-losbflib.c')
-rw-r--r-- | mail/OSBF-lua/patches/patch-losbflib.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/mail/OSBF-lua/patches/patch-losbflib.c b/mail/OSBF-lua/patches/patch-losbflib.c index 0baed0757c8..fc4cf06713c 100644 --- a/mail/OSBF-lua/patches/patch-losbflib.c +++ b/mail/OSBF-lua/patches/patch-losbflib.c @@ -1,9 +1,27 @@ -$NetBSD: patch-losbflib.c,v 1.1 2013/07/05 14:31:40 wiz Exp $ +$NetBSD: patch-losbflib.c,v 1.2 2013/10/11 20:25:34 wiz Exp $ Fix build with lua-5.2. --- losbflib.c.orig 2007-01-14 18:57:19.000000000 +0000 +++ losbflib.c +@@ -170,7 +170,7 @@ lua_osbf_createdb (lua_State * L) + luaL_checktype (L, 1, LUA_TTABLE); + + /* get the number of classes to create */ +- num_classes = luaL_getn (L, 1); ++ num_classes = (int) lua_rawlen (L, 1); + + /* get number of buckets */ + buckets = luaL_checknumber (L, 2); +@@ -214,7 +214,7 @@ lua_osbf_removedb (lua_State * L) + luaL_checktype (L, 1, LUA_TTABLE); + + /* get the number of classes to remove */ +- num_classes = luaL_getn (L, 1); ++ num_classes = (int) lua_rawlen (L, 1); + removed = 0; + lua_pushnil (L); /* first key */ + while (lua_next (L, 1) != 0) @@ -743,7 +743,7 @@ dir_gc (lua_State * L) /**********************************************************/ @@ -13,3 +31,27 @@ Fix build with lua-5.2. {"create_db", lua_osbf_createdb}, {"remove_db", lua_osbf_removedb}, {"config", lua_osbf_config}, +@@ -767,6 +767,8 @@ static const struct luaL_reg osbf[] = { + int + luaopen_osbf (lua_State * L) + { ++ size_t n_funcs; ++ + /* Open dir function */ + luaL_newmetatable (L, "LuaBook.dir"); + /* set its __gc field */ +@@ -774,7 +776,13 @@ luaopen_osbf (lua_State * L) + lua_pushcfunction (L, dir_gc); + lua_settable (L, -3); + +- luaL_register (L, "osbf", osbf); ++ n_funcs = sizeof(osbf)/sizeof(*osbf) - 1; ++ lua_createtable( L, 0, n_funcs ); ++ luaL_setfuncs( L, osbf, 0 ); ++ ++ lua_pushvalue( L, -1 ); ++ lua_setglobal( L, "osbf" ); ++ + set_info (L); + return 1; + } |