commit cdd0fe99464d7fb754f409dfec3277956eb30b83
parent bc8619342ae67226b55598047ab677bd93dfba5e
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 21 May 1999 16:41:27 -0300
some C compilers cannot initialize a local struct
Diffstat:
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/ltable.c b/ltable.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltable.c,v 1.20 1999/01/25 17:41:19 roberto Exp roberto $
+** $Id: ltable.c,v 1.21 1999/02/23 14:57:28 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@@ -140,7 +140,8 @@ void luaH_set (Hash *t, TObject *ref, TObject *val) {
if (ttype(ref(n)) != LUA_T_NIL)
*val(n) = *val;
else {
- TObject buff = *val; /* rehash may invalidate this address */
+ TObject buff;
+ buff = *val; /* rehash may invalidate this address */
if ((long)nuse(t)*3L > (long)nhash(t)*2L) {
rehash(t);
n = luaH_present(t, ref);
diff --git a/ltm.c b/ltm.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltm.c,v 1.23 1999/02/25 19:13:56 roberto Exp roberto $
+** $Id: ltm.c,v 1.24 1999/02/26 15:48:55 roberto Exp roberto $
** Tag methods
** See Copyright Notice in lua.h
*/
@@ -129,7 +129,7 @@ TObject *luaT_gettagmethod (int t, char *event) {
void luaT_settagmethod (int t, char *event, TObject *func) {
- TObject temp = *func;
+ TObject temp;
int e = luaI_checkevent(event, luaT_eventname);
checktag(t);
if (!luaT_validevent(t, e))
@@ -137,6 +137,7 @@ void luaT_settagmethod (int t, char *event, TObject *func) {
luaT_eventname[e], luaO_typenames[-t],
(t == LUA_T_ARRAY || t == LUA_T_USERDATA) ? " with default tag"
: "");
+ temp = *func;
*func = *luaT_getim(t,e);
*luaT_getim(t, e) = temp;
}
diff --git a/lvm.c b/lvm.c
@@ -1,5 +1,5 @@
/*
-** $Id: lvm.c,v 1.55 1999/04/13 19:28:49 roberto Exp roberto $
+** $Id: lvm.c,v 1.56 1999/05/21 17:23:15 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -214,7 +214,8 @@ void luaV_setglobal (TaggedString *ts) {
else {
/* WARNING: caller must assure stack space */
struct Stack *S = &L->stack;
- TObject newvalue = *(S->top-1);
+ TObject newvalue;
+ newvalue = *(S->top-1);
ttype(S->top-1) = LUA_T_STRING;
tsvalue(S->top-1) = ts;
*S->top++ = *oldvalue;
@@ -403,7 +404,8 @@ StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base) {
case PUSHSELFW: aux += highbyte(*pc++);
case PUSHSELF: aux += *pc++; {
- TObject receiver = *(S->top-1);
+ TObject receiver;
+ receiver = *(S->top-1);
*S->top++ = consts[aux];
luaV_gettable();
*S->top++ = receiver;
@@ -439,17 +441,17 @@ StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base) {
case SETLISTW: aux += highbyte(*pc++);
case SETLIST: aux += *pc++; {
int n = *(pc++);
- TObject *arr = S->top-n-1;
+ Hash *arr = avalue(S->top-n-1);
aux *= LFIELDS_PER_FLUSH;
for (; n; n--)
- luaH_setint(avalue(arr), n+aux, --S->top);
+ luaH_setint(arr, n+aux, --S->top);
break;
}
case SETMAP: aux = *pc++; {
- TObject *arr = S->top-(2*aux)-3;
+ Hash *arr = avalue(S->top-(2*aux)-3);
do {
- luaH_set(avalue(arr), S->top-2, S->top-1);
+ luaH_set(arr, S->top-2, S->top-1);
S->top-=2;
} while (aux--);
break;