diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-07-25 14:18:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-07-25 14:18:49 -0300 |
commit | 2557107e918b319c13f9a7b9b157cb660b239e7f (patch) | |
tree | f4d2fb351c2dbdb5928dc81adb91d480ca75b1e2 | |
parent | 32a12e2f3f18aeade5e2cd77eda67a261815246e (diff) | |
download | lua-2557107e918b319c13f9a7b9b157cb660b239e7f.tar.gz lua-2557107e918b319c13f9a7b9b157cb660b239e7f.tar.bz2 lua-2557107e918b319c13f9a7b9b157cb660b239e7f.zip |
removed unused variable 'found' (in 'findfield') + removed legacy
test for 'what' being "tail"
-rw-r--r-- | lauxlib.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.232 2011/05/03 16:01:57 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.233 2011/06/16 14:11:04 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -41,11 +41,10 @@ | |||
41 | ** return 1 + string at top if find a good name. | 41 | ** return 1 + string at top if find a good name. |
42 | */ | 42 | */ |
43 | static int findfield (lua_State *L, int objidx, int level) { | 43 | static int findfield (lua_State *L, int objidx, int level) { |
44 | int found = 0; | ||
45 | if (level == 0 || !lua_istable(L, -1)) | 44 | if (level == 0 || !lua_istable(L, -1)) |
46 | return 0; /* not found */ | 45 | return 0; /* not found */ |
47 | lua_pushnil(L); /* start 'next' loop */ | 46 | lua_pushnil(L); /* start 'next' loop */ |
48 | while (!found && lua_next(L, -2)) { /* for each pair in table */ | 47 | while (lua_next(L, -2)) { /* for each pair in table */ |
49 | if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ | 48 | if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ |
50 | if (lua_rawequal(L, objidx, -1)) { /* found object? */ | 49 | if (lua_rawequal(L, objidx, -1)) { /* found object? */ |
51 | lua_pop(L, 1); /* remove value (but keep name) */ | 50 | lua_pop(L, 1); /* remove value (but keep name) */ |
@@ -86,7 +85,7 @@ static void pushfuncname (lua_State *L, lua_Debug *ar) { | |||
86 | lua_pushfstring(L, "function " LUA_QS, ar->name); | 85 | lua_pushfstring(L, "function " LUA_QS, ar->name); |
87 | else if (*ar->what == 'm') /* main? */ | 86 | else if (*ar->what == 'm') /* main? */ |
88 | lua_pushfstring(L, "main chunk"); | 87 | lua_pushfstring(L, "main chunk"); |
89 | else if (*ar->what == 'C' || *ar->what == 't') { | 88 | else if (*ar->what == 'C') { |
90 | if (pushglobalfuncname(L, ar)) { | 89 | if (pushglobalfuncname(L, ar)) { |
91 | lua_pushfstring(L, "function " LUA_QS, lua_tostring(L, -1)); | 90 | lua_pushfstring(L, "function " LUA_QS, lua_tostring(L, -1)); |
92 | lua_remove(L, -2); /* remove name */ | 91 | lua_remove(L, -2); /* remove name */ |