From 47fc57a2529c83376883f36954082cfe80ae588f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 10 Dec 2003 10:13:36 -0200 Subject: `TObject' renamed to `TValue' + other name changes and better assertions for incremental garbage collection --- lundump.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'lundump.c') diff --git a/lundump.c b/lundump.c index 0777dc0f..10508ed4 100644 --- a/lundump.c +++ b/lundump.c @@ -1,5 +1,5 @@ /* -** $Id: lundump.c,v 1.63 2003/08/25 19:51:54 roberto Exp roberto $ +** $Id: lundump.c,v 1.64 2003/08/27 21:01:44 roberto Exp roberto $ ** load pre-compiled Lua chunks ** See Copyright Notice in lua.h */ @@ -158,13 +158,14 @@ static Proto* LoadFunction (LoadState* S, TString* p); static void LoadConstants (LoadState* S, Proto* f) { int i,n; + lua_State *L=S->L; n=LoadInt(S); - f->k=luaM_newvector(S->L,n,TObject); + f->k=luaM_newvector(L,n,TValue); f->sizek=n; for (i=0; ik[i]); for (i=0; ik[i]; + TValue* o=&f->k[i]; int t=LoadByte(S); switch (t) { @@ -172,18 +173,18 @@ static void LoadConstants (LoadState* S, Proto* f) setnvalue(o,LoadNumber(S)); break; case LUA_TSTRING: - setsvalue2n(o,LoadString(S)); + setsvalue2n(L, o,LoadString(S)); break; case LUA_TNIL: setnilvalue(o); break; default: - luaG_runerror(S->L,"bad constant type (%d) in %s",t,S->name); + luaG_runerror(L,"bad constant type (%d) in %s",t,S->name); break; } } n=LoadInt(S); - f->p=luaM_newvector(S->L,n,Proto*); + f->p=luaM_newvector(L,n,Proto*); f->sizep=n; for (i=0; ip[i]=NULL; for (i=0; ip[i]=LoadFunction(S,f->source); @@ -191,9 +192,10 @@ static void LoadConstants (LoadState* S, Proto* f) static Proto* LoadFunction (LoadState* S, TString* p) { - Proto* f=luaF_newproto(S->L); - setptvalue2s(S->L->top, f); - incr_top(S->L); + lua_State *L=S->L; + Proto* f=luaF_newproto(L); + setptvalue2s(L, L->top, f); + incr_top(L); f->source=LoadString(S); if (f->source==NULL) f->source=p; f->lineDefined=LoadInt(S); f->nups=LoadByte(S); @@ -206,9 +208,9 @@ static Proto* LoadFunction (LoadState* S, TString* p) LoadConstants(S,f); LoadCode(S,f); #ifndef TRUST_BINARIES - if (!luaG_checkcode(f)) luaG_runerror(S->L,"bad code in %s",S->name); + if (!luaG_checkcode(f)) luaG_runerror(L,"bad code in %s",S->name); #endif - S->L->top--; + L->top--; return f; } -- cgit v1.2.3-55-g6feb