diff --git a/lapi.c b/lapi.c index c26935c0..61a80085 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.151 2011/08/17 20:26:47 roberto Exp roberto $ +** $Id: lapi.c,v 2.152 2011/09/26 20:17:27 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -306,17 +306,17 @@ LUA_API void lua_arith (lua_State *L, int op) { LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { StkId o1, o2; - int i; + int i = 0; lua_lock(L); /* may call tag method */ o1 = index2addr(L, index1); o2 = index2addr(L, index2); - if (!isvalid(o1) || !isvalid(o2)) - i = 0; - else switch (op) { - case LUA_OPEQ: i = equalobj(L, o1, o2); break; - case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; - case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; - default: api_check(L, 0, "invalid option"); i = 0; + if (isvalid(o1) && isvalid(o2)) { + switch (op) { + case LUA_OPEQ: i = equalobj(L, o1, o2); break; + case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; + case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; + default: api_check(L, 0, "invalid option"); + } } lua_unlock(L); return i; diff --git a/lparser.c b/lparser.c index 7841c937..26b397ca 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.118 2011/08/30 16:38:58 roberto Exp roberto $ +** $Id: lparser.c,v 2.119 2011/09/14 17:40:26 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -1611,8 +1611,8 @@ Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, close_func(&lexstate); L->top--; /* pop name */ lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs); - return funcstate.f; /* all scopes should be correctly finished */ lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0); + return funcstate.f; }