avoid assignment to local structure
This commit is contained in:
27
lapi.c
27
lapi.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 1.97 2000/09/12 13:47:46 roberto Exp $
|
** $Id: lapi.c,v 1.98 2000/09/14 14:09:31 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -76,12 +76,11 @@ void lua_remove (lua_State *L, int index) {
|
|||||||
|
|
||||||
|
|
||||||
void lua_insert (lua_State *L, int index) {
|
void lua_insert (lua_State *L, int index) {
|
||||||
TObject temp = *(L->top-1);
|
|
||||||
StkId p = Index(L, index);
|
StkId p = Index(L, index);
|
||||||
StkId q;
|
StkId q;
|
||||||
for (q = L->top-1; q>p; q--)
|
for (q = L->top; q>p; q--)
|
||||||
*q = *(q-1);
|
*q = *(q-1);
|
||||||
*p = temp;
|
*p = *L->top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -249,16 +248,16 @@ void lua_getglobal (lua_State *L, const char *name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lua_gettable (lua_State *L, int tableindex) {
|
void lua_gettable (lua_State *L, int index) {
|
||||||
StkId t = Index(L, tableindex);
|
StkId t = Index(L, index);
|
||||||
StkId top = L->top;
|
StkId top = L->top;
|
||||||
*(top-1) = *luaV_gettable(L, t);
|
*(top-1) = *luaV_gettable(L, t);
|
||||||
L->top = top; /* tag method may change top */
|
L->top = top; /* tag method may change top */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lua_rawget (lua_State *L, int tableindex) {
|
void lua_rawget (lua_State *L, int index) {
|
||||||
StkId t = Index(L, tableindex);
|
StkId t = Index(L, index);
|
||||||
LUA_ASSERT(ttype(t) == TAG_TABLE, "table expected");
|
LUA_ASSERT(ttype(t) == TAG_TABLE, "table expected");
|
||||||
*(L->top - 1) = *luaH_get(L, hvalue(t), L->top - 1);
|
*(L->top - 1) = *luaH_get(L, hvalue(t), L->top - 1);
|
||||||
}
|
}
|
||||||
@@ -313,16 +312,16 @@ void lua_setglobal (lua_State *L, const char *name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lua_settable (lua_State *L, int tableindex) {
|
void lua_settable (lua_State *L, int index) {
|
||||||
StkId t = Index(L, tableindex);
|
StkId t = Index(L, index);
|
||||||
StkId top = L->top;
|
StkId top = L->top;
|
||||||
luaV_settable(L, t, top-2);
|
luaV_settable(L, t, top-2);
|
||||||
L->top = top-2; /* pop index and value */
|
L->top = top-2; /* pop index and value */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lua_rawset (lua_State *L, int tableindex) {
|
void lua_rawset (lua_State *L, int index) {
|
||||||
StkId t = Index(L, tableindex);
|
StkId t = Index(L, index);
|
||||||
LUA_ASSERT(ttype(t) == TAG_TABLE, "table expected");
|
LUA_ASSERT(ttype(t) == TAG_TABLE, "table expected");
|
||||||
*luaH_set(L, hvalue(t), L->top-2) = *(L->top-1);
|
*luaH_set(L, hvalue(t), L->top-2) = *(L->top-1);
|
||||||
L->top -= 2;
|
L->top -= 2;
|
||||||
@@ -406,8 +405,8 @@ void lua_unref (lua_State *L, int ref) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int lua_next (lua_State *L, int tableindex) {
|
int lua_next (lua_State *L, int index) {
|
||||||
StkId t = Index(L, tableindex);
|
StkId t = Index(L, index);
|
||||||
Node *n;
|
Node *n;
|
||||||
LUA_ASSERT(ttype(t) == TAG_TABLE, "table expected");
|
LUA_ASSERT(ttype(t) == TAG_TABLE, "table expected");
|
||||||
n = luaH_next(L, hvalue(t), Index(L, -1));
|
n = luaH_next(L, hvalue(t), Index(L, -1));
|
||||||
|
|||||||
Reference in New Issue
Block a user