Dump doesn't need to reuse 'source'

All strings are being reused now, including 'source'.
This commit is contained in:
Roberto Ierusalimschy
2022-12-20 11:14:52 -03:00
parent d70a0c91ad
commit 7d6a97e42b
3 changed files with 35 additions and 12 deletions

12
ldump.c
View File

@@ -126,7 +126,7 @@ static void dumpCode (DumpState *D, const Proto *f) {
}
static void dumpFunction(DumpState *D, const Proto *f, TString *psource);
static void dumpFunction(DumpState *D, const Proto *f);
static void dumpConstants (DumpState *D, const Proto *f) {
int i;
@@ -159,7 +159,7 @@ static void dumpProtos (DumpState *D, const Proto *f) {
int n = f->sizep;
dumpInt(D, n);
for (i = 0; i < n; i++)
dumpFunction(D, f->p[i], f->source);
dumpFunction(D, f->p[i]);
}
@@ -199,9 +199,9 @@ static void dumpDebug (DumpState *D, const Proto *f) {
}
static void dumpFunction (DumpState *D, const Proto *f, TString *psource) {
if (D->strip || f->source == psource)
dumpString(D, NULL); /* no debug info or same source as its parent */
static void dumpFunction (DumpState *D, const Proto *f) {
if (D->strip)
dumpString(D, NULL); /* no debug info */
else
dumpString(D, f->source);
dumpInt(D, f->linedefined);
@@ -245,7 +245,7 @@ int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data,
D.nstr = 0;
dumpHeader(&D);
dumpByte(&D, f->sizeupvalues);
dumpFunction(&D, f, NULL);
dumpFunction(&D, f);
return D.status;
}