diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-01-18 20:36:50 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-01-18 20:36:50 -0200 |
commit | e7c989baf16aee1f2b5ad52bc512c5c02d9d4048 (patch) | |
tree | 6a4713c4974ed96e70fe40e49061f3efd82354a3 /ldo.c | |
parent | 7a3c8314aca39e665078989a9846d79aac056db4 (diff) | |
download | lua-e7c989baf16aee1f2b5ad52bc512c5c02d9d4048.tar.gz lua-e7c989baf16aee1f2b5ad52bc512c5c02d9d4048.tar.bz2 lua-e7c989baf16aee1f2b5ad52bc512c5c02d9d4048.zip |
avoid calling "tail return" hooks if the hook itself turns off the event
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.44 2006/10/10 17:40:17 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.45 2007/03/27 14:11:38 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -332,7 +332,7 @@ static StkId callrethooks (lua_State *L, StkId firstResult) { | |||
332 | ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ | 332 | ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ |
333 | luaD_callhook(L, LUA_HOOKRET, -1); | 333 | luaD_callhook(L, LUA_HOOKRET, -1); |
334 | if (f_isLua(L->ci)) { /* Lua function? */ | 334 | if (f_isLua(L->ci)) { /* Lua function? */ |
335 | while (L->ci->tailcalls--) /* call hook for possible tail calls */ | 335 | while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */ |
336 | luaD_callhook(L, LUA_HOOKTAILRET, -1); | 336 | luaD_callhook(L, LUA_HOOKTAILRET, -1); |
337 | } | 337 | } |
338 | return restorestack(L, fr); | 338 | return restorestack(L, fr); |