wslua: do not pop from empty stack on newer LUA versions

Fixes this failure:

    tshark: lapi.c:175: lua_settop: Assertion `(-(idx+1) <= (L->top - (func + 1))) && "invalid new top"' failed.

Found using LUA 5.2 compiled with -DLUA_USE_APICHECK. Note that the
value returned by luaopen_bit does not affect the size of the stack
after using lua_call; if there are excess return values, then these will
be dropped after calling lua_call. See http://www.lua.org/pil/26.2.html

I also verified that the stack is still empty after calling all
wslua_reg_module functions.

Change-Id: Ia72635277ca4d8077e47a5c472391a78fe6d311e
Reviewed-on: https://code.wireshark.org/review/10664
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2015-09-28 00:08:39 +02:00
parent 01bd832b9d
commit f52d1d52a6
1 changed files with 0 additions and 2 deletions

View File

@ -87,8 +87,6 @@ for (@classes) {
print C "\twslua_reg_module(L, \"${_}\", ${_}_register);\n";
}
print C "\twslua_reg_module(L, \"bit\", luaopen_bit);\n";
# the bitops library returns a value on the stack - get rid of it
print C "\tlua_pop(L,1);\n";
print C "\twslua_reg_module(L, \"GRegex\", luaopen_rex_glib);\n";
print C "}\n\n";