eris: 'checksequence' is no longer needed in ltable.c
This commit is contained in:
@@ -98,34 +98,6 @@ static ANode *nthanode(Table *t, int n) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checksequence(Table *t) {
|
|
||||||
assert(t->nnkeys >= 0);
|
|
||||||
int nodesize = truesizenode(t);
|
|
||||||
int totalanodes = t->sizearray + nodesize;
|
|
||||||
for (int i = 0; i < t->nnkeys; i++) {
|
|
||||||
int anodeindex = t->sequence[i];
|
|
||||||
assert((anodeindex >= 0) && (anodeindex < totalanodes));
|
|
||||||
ANode *n = nthanode(t, anodeindex);
|
|
||||||
assert(n->i_sequence == i);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < t->sizearray; i++) {
|
|
||||||
int seqno = t->array[i].i_sequence;
|
|
||||||
if (seqno != -1) {
|
|
||||||
assert((seqno >= 0) && (seqno < t->nnkeys));
|
|
||||||
assert(t->sequence[seqno] == i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i < nodesize; i++) {
|
|
||||||
Node *n = t->node + i;
|
|
||||||
int seqno = gseq(n);
|
|
||||||
if (seqno != -1) {
|
|
||||||
assert((seqno >= 0) && (seqno < t->nnkeys));
|
|
||||||
assert(t->sequence[seqno] == i + t->sizearray);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** hash for lua_Numbers
|
** hash for lua_Numbers
|
||||||
*/
|
*/
|
||||||
@@ -697,7 +669,6 @@ void luaH_setnil(Table *t, ANode *anode) {
|
|||||||
** barrier and invalidate the TM cache.
|
** barrier and invalidate the TM cache.
|
||||||
*/
|
*/
|
||||||
void luaH_setupdate (lua_State *L, Table *t, const TValue *key, TValue *value, const TValue *getres) {
|
void luaH_setupdate (lua_State *L, Table *t, const TValue *key, TValue *value, const TValue *getres) {
|
||||||
checksequence(t);
|
|
||||||
if (!ttisnil(getres)) {
|
if (!ttisnil(getres)) {
|
||||||
if (ttisnil(value)) {
|
if (ttisnil(value)) {
|
||||||
/* replacing a non-nil value with nil */
|
/* replacing a non-nil value with nil */
|
||||||
@@ -705,12 +676,10 @@ void luaH_setupdate (lua_State *L, Table *t, const TValue *key, TValue *value, c
|
|||||||
t->lastdeleted = anode;
|
t->lastdeleted = anode;
|
||||||
t->lastdelseq = anode->i_sequence;
|
t->lastdelseq = anode->i_sequence;
|
||||||
luaH_setnil(t, anode);
|
luaH_setnil(t, anode);
|
||||||
checksequence(t);
|
|
||||||
} else {
|
} else {
|
||||||
/* replacing a non-nil value with a different non-nil value */
|
/* replacing a non-nil value with a different non-nil value */
|
||||||
TValue *cell = cast(TValue *, getres);
|
TValue *cell = cast(TValue *, getres);
|
||||||
setobj2t(L, cell, value);
|
setobj2t(L, cell, value);
|
||||||
checksequence(t);
|
|
||||||
}
|
}
|
||||||
} else if (getres == luaO_nilobject) {
|
} else if (getres == luaO_nilobject) {
|
||||||
if (!ttisnil(value)) {
|
if (!ttisnil(value)) {
|
||||||
@@ -719,14 +688,12 @@ void luaH_setupdate (lua_State *L, Table *t, const TValue *key, TValue *value, c
|
|||||||
t->lastdelseq = -1;
|
t->lastdelseq = -1;
|
||||||
ANode *anode = cast(ANode *, luaH_newkey(L, t, key));
|
ANode *anode = cast(ANode *, luaH_newkey(L, t, key));
|
||||||
luaH_setnonnil(t, anode, value);
|
luaH_setnonnil(t, anode, value);
|
||||||
checksequence(t);
|
|
||||||
}
|
}
|
||||||
} else if (!ttisnil(value)) {
|
} else if (!ttisnil(value)) {
|
||||||
/* replacing a nil value with a non-nil value */
|
/* replacing a nil value with a non-nil value */
|
||||||
t->lastdeleted = NULL;
|
t->lastdeleted = NULL;
|
||||||
t->lastdelseq = -1;
|
t->lastdelseq = -1;
|
||||||
luaH_setnonnil(t, cast(ANode *, getres), value);
|
luaH_setnonnil(t, cast(ANode *, getres), value);
|
||||||
checksequence(t);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user