summaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-11-03 16:10:44 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-11-03 16:10:44 -0200
commit748551238451acf36a245fb2f883293149e2f0ca (patch)
tree54ddfebfa1ebc31392a210b50baa64a042d09223 /ltable.c
parent46de77b219e381ff8553fdba0f52b319c00ea1e1 (diff)
downloadlua-748551238451acf36a245fb2f883293149e2f0ca.tar.gz
lua-748551238451acf36a245fb2f883293149e2f0ca.tar.bz2
lua-748551238451acf36a245fb2f883293149e2f0ca.zip
added comment and assert about dead keys
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ltable.c b/ltable.c
index e47b81f7..13d39dd3 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.113 2015/07/04 16:32:34 roberto Exp roberto $ 2** $Id: ltable.c,v 2.114 2015/11/03 15:47:30 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -133,6 +133,7 @@ static Node *mainposition (const Table *t, const TValue *key) {
133 case LUA_TLCF: 133 case LUA_TLCF:
134 return hashpointer(t, fvalue(key)); 134 return hashpointer(t, fvalue(key));
135 default: 135 default:
136 lua_assert(!ttisdeadkey(key));
136 return hashpointer(t, gcvalue(key)); 137 return hashpointer(t, gcvalue(key));
137 } 138 }
138} 139}
@@ -457,7 +458,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
457 Node *f = getfreepos(t); /* get a free place */ 458 Node *f = getfreepos(t); /* get a free place */
458 if (f == NULL) { /* cannot find a free place? */ 459 if (f == NULL) { /* cannot find a free place? */
459 rehash(L, t, key); /* grow table */ 460 rehash(L, t, key); /* grow table */
460 /* whatever called 'newkey' takes care of TM cache and GC barrier */ 461 /* whatever called 'newkey' takes care of TM cache */
461 return luaH_set(L, t, key); /* insert key into grown table */ 462 return luaH_set(L, t, key); /* insert key into grown table */
462 } 463 }
463 lua_assert(!isdummy(f)); 464 lua_assert(!isdummy(f));