lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 331632e8d8861a62b69ae7c3c9a148411c5a44ab
parent 7d930ec694dc079a252323d2136fbf4d49a49888
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 13 Mar 2015 13:24:25 -0300

code detail ('if' -> '?:')

Diffstat:
Mltests.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ltests.c b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 2.202 2015/01/16 16:54:37 roberto Exp roberto $ +** $Id: ltests.c,v 2.203 2015/03/11 16:10:41 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -289,11 +289,11 @@ static void checkLclosure (global_State *g, LClosure *cl) { static int lua_checkpc (lua_State *L, CallInfo *ci) { if (!isLua(ci)) return 1; else { - Proto *p; - if (L->status != LUA_YIELD || ci != L->ci) - p = clLvalue(ci->func)->p; - else /* real 'func' was saved in 'extra' field */ - p = clLvalue(restorestack(L, ci->extra))->p; + /* if function yielded (inside a hook), real 'func' is in 'extra' field */ + StkId f = (L->status != LUA_YIELD || ci != L->ci) + ? ci->func + : restorestack(L, ci->extra); + Proto *p = clLvalue(f)->p; return p->code <= ci->u.l.savedpc && ci->u.l.savedpc <= p->code + p->sizecode; }