diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-10-28 10:06:45 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-10-28 10:06:45 -0200 |
commit | 3cdf1d676bc5a2431a49036dd3f6412d6913aa2a (patch) | |
tree | 8d200aceca9a0cb6a21896f1b0dc08fcd0d5d150 | |
parent | 82129b92662d43e1a49cb63f5e42f01d098d21cf (diff) | |
download | lua-3cdf1d676bc5a2431a49036dd3f6412d6913aa2a.tar.gz lua-3cdf1d676bc5a2431a49036dd3f6412d6913aa2a.tar.bz2 lua-3cdf1d676bc5a2431a49036dd3f6412d6913aa2a.zip |
details (avoid 'case' inside block + avoid using one variable for
two roles)
-rw-r--r-- | ldo.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.140 2015/09/08 15:41:05 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.141 2015/10/21 18:40:47 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 | */ |
@@ -321,14 +321,14 @@ static void tryfuncTM (lua_State *L, StkId func) { | |||
321 | int luaD_precall (lua_State *L, StkId func, int nresults) { | 321 | int luaD_precall (lua_State *L, StkId func, int nresults) { |
322 | lua_CFunction f; | 322 | lua_CFunction f; |
323 | CallInfo *ci; | 323 | CallInfo *ci; |
324 | int n; /* number of arguments (Lua) or returns (C) */ | ||
325 | switch (ttype(func)) { | 324 | switch (ttype(func)) { |
326 | case LUA_TCCL: { /* C closure */ | 325 | case LUA_TCCL: /* C closure */ |
327 | f = clCvalue(func)->f; | 326 | f = clCvalue(func)->f; |
328 | goto Cfunc; | 327 | goto Cfunc; |
329 | case LUA_TLCF: /* light C function */ | 328 | case LUA_TLCF: /* light C function */ |
330 | f = fvalue(func); | 329 | f = fvalue(func); |
331 | Cfunc: | 330 | Cfunc: { |
331 | int n; /* number of returns */ | ||
332 | checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ | 332 | checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ |
333 | ci = next_ci(L); /* now 'enter' new function */ | 333 | ci = next_ci(L); /* now 'enter' new function */ |
334 | ci->nresults = nresults; | 334 | ci->nresults = nresults; |
@@ -348,7 +348,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { | |||
348 | case LUA_TLCL: { /* Lua function: prepare its call */ | 348 | case LUA_TLCL: { /* Lua function: prepare its call */ |
349 | StkId base; | 349 | StkId base; |
350 | Proto *p = clLvalue(func)->p; | 350 | Proto *p = clLvalue(func)->p; |
351 | n = cast_int(L->top - func) - 1; /* number of real arguments */ | 351 | int n = cast_int(L->top - func) - 1; /* number of real arguments */ |
352 | checkstackp(L, p->maxstacksize, func); | 352 | checkstackp(L, p->maxstacksize, func); |
353 | for (; n < p->numparams; n++) | 353 | for (; n < p->numparams; n++) |
354 | setnilvalue(L->top++); /* complete missing arguments */ | 354 | setnilvalue(L->top++); /* complete missing arguments */ |