diff options
| author | Lua Team <team@lua.org> | 2011-11-30 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 2011-11-30 12:00:00 +0000 |
| commit | ed0f7cc8d3f96dce4dac98bc395506f0513a332c (patch) | |
| tree | 74d1d70594793be2284559b22c68cc0355007379 /src/ltable.c | |
| parent | ac1beaea25f1fec341e1edb168c63ac7131a6bdd (diff) | |
| download | lua-github-ed0f7cc8d3f96dce4dac98bc395506f0513a332c.tar.gz | |
Lua 5.2.0-rc45.2.0-rc4
Diffstat (limited to 'src/ltable.c')
| -rw-r--r-- | src/ltable.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ltable.c b/src/ltable.c index b4aa26c0..9581add9 100644 --- a/src/ltable.c +++ b/src/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 2.66 2011/11/28 17:25:48 roberto Exp $ +** $Id: ltable.c,v 2.67 2011/11/30 12:41:45 roberto Exp $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -141,7 +141,7 @@ static int findindex (lua_State *L, Table *t, StkId key) { return i-1; /* yes; that's the index (corrected to C) */ else { Node *n = mainposition(t, key); - do { /* check whether `key' is somewhere in the chain */ + for (;;) { /* check whether `key' is somewhere in the chain */ /* key may be dead already, but it is ok to use it in `next' */ if (luaV_rawequalobj(gkey(n), key) || (ttisdeadkey(gkey(n)) && iscollectable(key) && @@ -151,9 +151,9 @@ static int findindex (lua_State *L, Table *t, StkId key) { return i + t->sizearray; } else n = gnext(n); - } while (n); - luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ - return 0; /* to avoid warnings */ + if (n == NULL) + luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ + } } } |
