aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-05-21 16:41:49 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-05-21 16:41:49 -0300
commitcdd0fe99464d7fb754f409dfec3277956eb30b83 (patch)
treee14aa7bdec23d04bd63b331a735831c791fb4acb
parentbc8619342ae67226b55598047ab677bd93dfba5e (diff)
downloadlua-cdd0fe99464d7fb754f409dfec3277956eb30b83.tar.gz
lua-cdd0fe99464d7fb754f409dfec3277956eb30b83.tar.bz2
lua-cdd0fe99464d7fb754f409dfec3277956eb30b83.zip
some C compilers cannot initialize a local struct
-rw-r--r--ltable.c5
-rw-r--r--ltm.c5
-rw-r--r--lvm.c16
3 files changed, 15 insertions, 11 deletions
diff --git a/ltable.c b/ltable.c
index 85cc6218..73a6011e 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.20 1999/01/25 17:41:19 roberto Exp roberto $ 2** $Id: ltable.c,v 1.21 1999/02/23 14:57:28 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*/
@@ -140,7 +140,8 @@ void luaH_set (Hash *t, TObject *ref, TObject *val) {
140 if (ttype(ref(n)) != LUA_T_NIL) 140 if (ttype(ref(n)) != LUA_T_NIL)
141 *val(n) = *val; 141 *val(n) = *val;
142 else { 142 else {
143 TObject buff = *val; /* rehash may invalidate this address */ 143 TObject buff;
144 buff = *val; /* rehash may invalidate this address */
144 if ((long)nuse(t)*3L > (long)nhash(t)*2L) { 145 if ((long)nuse(t)*3L > (long)nhash(t)*2L) {
145 rehash(t); 146 rehash(t);
146 n = luaH_present(t, ref); 147 n = luaH_present(t, ref);
diff --git a/ltm.c b/ltm.c
index d827baa1..a9b3b515 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 1.23 1999/02/25 19:13:56 roberto Exp roberto $ 2** $Id: ltm.c,v 1.24 1999/02/26 15:48:55 roberto Exp roberto $
3** Tag methods 3** Tag methods
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -129,7 +129,7 @@ TObject *luaT_gettagmethod (int t, char *event) {
129 129
130 130
131void luaT_settagmethod (int t, char *event, TObject *func) { 131void luaT_settagmethod (int t, char *event, TObject *func) {
132 TObject temp = *func; 132 TObject temp;
133 int e = luaI_checkevent(event, luaT_eventname); 133 int e = luaI_checkevent(event, luaT_eventname);
134 checktag(t); 134 checktag(t);
135 if (!luaT_validevent(t, e)) 135 if (!luaT_validevent(t, e))
@@ -137,6 +137,7 @@ void luaT_settagmethod (int t, char *event, TObject *func) {
137 luaT_eventname[e], luaO_typenames[-t], 137 luaT_eventname[e], luaO_typenames[-t],
138 (t == LUA_T_ARRAY || t == LUA_T_USERDATA) ? " with default tag" 138 (t == LUA_T_ARRAY || t == LUA_T_USERDATA) ? " with default tag"
139 : ""); 139 : "");
140 temp = *func;
140 *func = *luaT_getim(t,e); 141 *func = *luaT_getim(t,e);
141 *luaT_getim(t, e) = temp; 142 *luaT_getim(t, e) = temp;
142} 143}
diff --git a/lvm.c b/lvm.c
index 376e9506..1fc45e97 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.55 1999/04/13 19:28:49 roberto Exp roberto $ 2** $Id: lvm.c,v 1.56 1999/05/21 17:23:15 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -214,7 +214,8 @@ void luaV_setglobal (TaggedString *ts) {
214 else { 214 else {
215 /* WARNING: caller must assure stack space */ 215 /* WARNING: caller must assure stack space */
216 struct Stack *S = &L->stack; 216 struct Stack *S = &L->stack;
217 TObject newvalue = *(S->top-1); 217 TObject newvalue;
218 newvalue = *(S->top-1);
218 ttype(S->top-1) = LUA_T_STRING; 219 ttype(S->top-1) = LUA_T_STRING;
219 tsvalue(S->top-1) = ts; 220 tsvalue(S->top-1) = ts;
220 *S->top++ = *oldvalue; 221 *S->top++ = *oldvalue;
@@ -403,7 +404,8 @@ StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base) {
403 404
404 case PUSHSELFW: aux += highbyte(*pc++); 405 case PUSHSELFW: aux += highbyte(*pc++);
405 case PUSHSELF: aux += *pc++; { 406 case PUSHSELF: aux += *pc++; {
406 TObject receiver = *(S->top-1); 407 TObject receiver;
408 receiver = *(S->top-1);
407 *S->top++ = consts[aux]; 409 *S->top++ = consts[aux];
408 luaV_gettable(); 410 luaV_gettable();
409 *S->top++ = receiver; 411 *S->top++ = receiver;
@@ -439,17 +441,17 @@ StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base) {
439 case SETLISTW: aux += highbyte(*pc++); 441 case SETLISTW: aux += highbyte(*pc++);
440 case SETLIST: aux += *pc++; { 442 case SETLIST: aux += *pc++; {
441 int n = *(pc++); 443 int n = *(pc++);
442 TObject *arr = S->top-n-1; 444 Hash *arr = avalue(S->top-n-1);
443 aux *= LFIELDS_PER_FLUSH; 445 aux *= LFIELDS_PER_FLUSH;
444 for (; n; n--) 446 for (; n; n--)
445 luaH_setint(avalue(arr), n+aux, --S->top); 447 luaH_setint(arr, n+aux, --S->top);
446 break; 448 break;
447 } 449 }
448 450
449 case SETMAP: aux = *pc++; { 451 case SETMAP: aux = *pc++; {
450 TObject *arr = S->top-(2*aux)-3; 452 Hash *arr = avalue(S->top-(2*aux)-3);
451 do { 453 do {
452 luaH_set(avalue(arr), S->top-2, S->top-1); 454 luaH_set(arr, S->top-2, S->top-1);
453 S->top-=2; 455 S->top-=2;
454 } while (aux--); 456 } while (aux--);
455 break; 457 break;