diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-05-30 13:36:38 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-05-30 13:36:38 -0300 |
commit | 3f04a9f2c07bc06dddbc473178b314f1fd686701 (patch) | |
tree | b358256ba651ec90371393eab95bdcb10805e101 | |
parent | 2a59a999d482daa619cbf8fc8f78918d9a0c7e77 (diff) | |
download | lua-3f04a9f2c07bc06dddbc473178b314f1fd686701.tar.gz lua-3f04a9f2c07bc06dddbc473178b314f1fd686701.tar.bz2 lua-3f04a9f2c07bc06dddbc473178b314f1fd686701.zip |
code is simpler without 'goto' here
-rw-r--r-- | ldo.c | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.92 2011/02/07 17:14:50 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.93 2011/02/23 13:13:10 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 | */ |
@@ -299,16 +299,10 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { | |||
299 | if (!ttisfunction(func)) /* `func' is not a function? */ | 299 | if (!ttisfunction(func)) /* `func' is not a function? */ |
300 | func = tryfuncTM(L, func); /* check the `function' tag method */ | 300 | func = tryfuncTM(L, func); /* check the `function' tag method */ |
301 | funcr = savestack(L, func); | 301 | funcr = savestack(L, func); |
302 | if (ttislcf(func)) { /* light C function? */ | 302 | if (ttislcf(func) || (cl = clvalue(func), cl->c.isC)) { /* C function? */ |
303 | f = fvalue(func); /* get it */ | ||
304 | goto isCfunc; /* go to call it */ | ||
305 | } | ||
306 | cl = clvalue(func); | ||
307 | if (cl->c.isC) { /* C closure? */ | ||
308 | CallInfo *ci; | 303 | CallInfo *ci; |
309 | int n; | 304 | int n; |
310 | f = cl->c.f; | 305 | f = (ttislcf(func) ? fvalue(func) : cl->c.f); |
311 | isCfunc: /* call C function 'f' */ | ||
312 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ | 306 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ |
313 | ci = next_ci(L); /* now 'enter' new function */ | 307 | ci = next_ci(L); /* now 'enter' new function */ |
314 | ci->nresults = nresults; | 308 | ci->nresults = nresults; |