From 1475cb59bf16c6af7ecd937e13da0ca0f451a191 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 25 Oct 2010 12:33:38 -0200 Subject: version from lhf --- ldump.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'ldump.c') diff --git a/ldump.c b/ldump.c index 007f2223..54a7bb48 100644 --- a/ldump.c +++ b/ldump.c @@ -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; ip[i],f->source,D); + for (i=0; ip[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; iupvalues[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; } -- cgit v1.2.1