From e24f1ee9ff2def53a5cca19038d8b1ee6afc5c62 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 30 Sep 2011 09:44:45 -0300 Subject: [PATCH] lint (unreachable code) --- lapi.c | 18 +++++++++--------- lparser.c | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) 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; }