diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-15 14:30:52 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-15 14:30:52 -0300 |
| commit | d406d3d05ffe8bc01d6416437963ce092cfc9772 (patch) | |
| tree | 76eb08db5aa34e5ce9c88cf3560f49e825183f91 | |
| parent | b6780ee41b1f5c120601a72b12d81e3ce71a8971 (diff) | |
| download | lua-d406d3d05ffe8bc01d6416437963ce092cfc9772.tar.gz lua-d406d3d05ffe8bc01d6416437963ce092cfc9772.tar.bz2 lua-d406d3d05ffe8bc01d6416437963ce092cfc9772.zip | |
removed unused macros 'isstackindex'/'api_checkstackindex' +
macro 'api_checkvalidindex' (used only once) expanded and removed
| -rw-r--r-- | lapi.c | 12 |
1 files changed, 2 insertions, 10 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.291 2018/04/04 14:23:41 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.292 2018/06/01 17:40:38 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -51,14 +51,6 @@ static const TValue nonvalidvaluep = {NILCONSTANT}; | |||
| 51 | /* test for upvalue */ | 51 | /* test for upvalue */ |
| 52 | #define isupvalue(i) ((i) < LUA_REGISTRYINDEX) | 52 | #define isupvalue(i) ((i) < LUA_REGISTRYINDEX) |
| 53 | 53 | ||
| 54 | /* test for valid but not pseudo index */ | ||
| 55 | #define isstackindex(i, o) (isvalid(o) && !ispseudo(i)) | ||
| 56 | |||
| 57 | #define api_checkvalidindex(l,o) api_check(l, isvalid(o), "invalid index") | ||
| 58 | |||
| 59 | #define api_checkstackindex(l, i, o) \ | ||
| 60 | api_check(l, isstackindex(i, o), "index not in the stack") | ||
| 61 | |||
| 62 | 54 | ||
| 63 | static TValue *index2value (lua_State *L, int idx) { | 55 | static TValue *index2value (lua_State *L, int idx) { |
| 64 | CallInfo *ci = L->ci; | 56 | CallInfo *ci = L->ci; |
| @@ -233,7 +225,7 @@ LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { | |||
| 233 | lua_lock(L); | 225 | lua_lock(L); |
| 234 | fr = index2value(L, fromidx); | 226 | fr = index2value(L, fromidx); |
| 235 | to = index2value(L, toidx); | 227 | to = index2value(L, toidx); |
| 236 | api_checkvalidindex(L, to); | 228 | api_check(l, isvalid(to), "invalid index"); |
| 237 | setobj(L, to, fr); | 229 | setobj(L, to, fr); |
| 238 | if (isupvalue(toidx)) /* function upvalue? */ | 230 | if (isupvalue(toidx)) /* function upvalue? */ |
| 239 | luaC_barrier(L, clCvalue(s2v(L->ci->func)), fr); | 231 | luaC_barrier(L, clCvalue(s2v(L->ci->func)), fr); |
