Some cleaning in the new table API
This commit is contained in:
8
lcode.c
8
lcode.c
@@ -544,10 +544,10 @@ static int addk (FuncState *fs, TValue *key, TValue *v) {
|
||||
TValue val;
|
||||
lua_State *L = fs->ls->L;
|
||||
Proto *f = fs->f;
|
||||
const TValue *idx = luaH_get(fs->ls->h, key); /* query scanner table */
|
||||
int aux = luaH_get(fs->ls->h, key, &val); /* query scanner table */
|
||||
int k, oldsize;
|
||||
if (ttisinteger(idx)) { /* is there an index there? */
|
||||
k = cast_int(ivalue(idx));
|
||||
if (aux == HOK && ttisinteger(&val)) { /* is there an index there? */
|
||||
k = cast_int(ivalue(&val));
|
||||
/* correct value? (warning: must distinguish floats from integers!) */
|
||||
if (k < fs->nk && ttypetag(&f->k[k]) == ttypetag(v) &&
|
||||
luaV_rawequalobj(&f->k[k], v))
|
||||
@@ -559,7 +559,7 @@ static int addk (FuncState *fs, TValue *key, TValue *v) {
|
||||
/* numerical value does not need GC barrier;
|
||||
table has no metatable, so it does not need to invalidate cache */
|
||||
setivalue(&val, k);
|
||||
luaH_finishset(L, fs->ls->h, key, idx, &val);
|
||||
luaH_set(L, fs->ls->h, key, &val);
|
||||
luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants");
|
||||
while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
|
||||
setobj(L, &f->k[k], v);
|
||||
|
||||
Reference in New Issue
Block a user