diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-10-25 12:33:38 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-10-25 12:33:38 -0200 |
commit | 1475cb59bf16c6af7ecd937e13da0ca0f451a191 (patch) | |
tree | 5f74b1bbd198b71dbfc752669f65bd958771a9e1 /ldump.c | |
parent | 9e8e60dd5f2223aaabd8239b9152167a8b630b4a (diff) | |
download | lua-github-1475cb59bf16c6af7ecd937e13da0ca0f451a191.tar.gz |
version from lhf
Diffstat (limited to 'ldump.c')
-rw-r--r-- | ldump.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -1,5 +1,5 @@ /* -** $Id: ldump.c,v 2.12 2009/09/30 15:38:37 roberto Exp roberto $ +** $Id: ldump.c,v 1.17 2010/10/13 21:04:52 lhf Exp $ ** save precompiled Lua chunks ** See Copyright Notice in lua.h */ @@ -75,7 +75,7 @@ static void DumpString(const TString* s, DumpState* D) #define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) -static void DumpFunction(const Proto* f, const TString* p, DumpState* D); +static void DumpFunction(const Proto* f, DumpState* D); static void DumpConstants(const Proto* f, DumpState* D) { @@ -98,14 +98,11 @@ static void DumpConstants(const Proto* f, DumpState* D) case LUA_TSTRING: DumpString(rawtsvalue(o),D); break; - default: - lua_assert(0); /* cannot happen */ - break; } } n=f->sizep; DumpInt(n,D); - for (i=0; i<n; i++) DumpFunction(f->p[i],f->source,D); + for (i=0; i<n; i++) DumpFunction(f->p[i],D); } static void DumpUpvalues(const Proto* f, DumpState* D) @@ -122,6 +119,7 @@ static void DumpUpvalues(const Proto* f, DumpState* D) static void DumpDebug(const Proto* f, DumpState* D) { int i,n; + DumpString((D->strip) ? NULL : f->source,D); n= (D->strip) ? 0 : f->sizelineinfo; DumpVector(f->lineinfo,n,sizeof(int),D); n= (D->strip) ? 0 : f->sizelocvars; @@ -137,9 +135,8 @@ static void DumpDebug(const Proto* f, DumpState* D) for (i=0; i<n; i++) DumpString(f->upvalues[i].name,D); } -static void DumpFunction(const Proto* f, const TString* p, DumpState* D) +static void DumpFunction(const Proto* f, DumpState* D) { - DumpString((f->source==p || D->strip) ? NULL : f->source,D); DumpInt(f->linedefined,D); DumpInt(f->lastlinedefined,D); DumpChar(f->numparams,D); @@ -170,6 +167,6 @@ int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip D.strip=strip; D.status=0; DumpHeader(&D); - DumpFunction(f,NULL,&D); + DumpFunction(f,&D); return D.status; } |