diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-06-18 10:21:12 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-06-18 10:21:12 -0300 |
commit | 94266dfdbd25b43fb84e6dc7752cdb069f0335e9 (patch) | |
tree | 713bcc5719fcd2f5a360d6135dcbaabbf14f07ae | |
parent | e3871abe95446658383ec3576f473a5f1005736e (diff) | |
download | lua-94266dfdbd25b43fb84e6dc7752cdb069f0335e9.tar.gz lua-94266dfdbd25b43fb84e6dc7752cdb069f0335e9.tar.bz2 lua-94266dfdbd25b43fb84e6dc7752cdb069f0335e9.zip |
source for all prototypes must be equal in a chunk; no need to store
each one separated
-rw-r--r-- | ldump.c | 4 | ||||
-rw-r--r-- | lundump.c | 6 |
2 files changed, 6 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldump.c,v 2.28 2014/03/27 15:58:05 roberto Exp roberto $ | 2 | ** $Id: ldump.c,v 2.29 2014/04/01 14:39:55 roberto Exp roberto $ |
3 | ** save precompiled Lua chunks | 3 | ** save precompiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -137,7 +137,6 @@ static void DumpUpvalues (const Proto *f, DumpState *D) { | |||
137 | 137 | ||
138 | static void DumpDebug (const Proto *f, DumpState *D) { | 138 | static void DumpDebug (const Proto *f, DumpState *D) { |
139 | int i, n; | 139 | int i, n; |
140 | DumpString((D->strip) ? NULL : f->source, D); | ||
141 | n = (D->strip) ? 0 : f->sizelineinfo; | 140 | n = (D->strip) ? 0 : f->sizelineinfo; |
142 | DumpInt(n, D); | 141 | DumpInt(n, D); |
143 | DumpVector(f->lineinfo, n, D); | 142 | DumpVector(f->lineinfo, n, D); |
@@ -196,6 +195,7 @@ int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, | |||
196 | D.status = 0; | 195 | D.status = 0; |
197 | DumpHeader(&D); | 196 | DumpHeader(&D); |
198 | DumpByte(f->sizeupvalues, &D); | 197 | DumpByte(f->sizeupvalues, &D); |
198 | DumpString((D.strip) ? NULL : f->source, &D); | ||
199 | DumpFunction(f, &D); | 199 | DumpFunction(f, &D); |
200 | return D.status; | 200 | return D.status; |
201 | } | 201 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.c,v 2.36 2014/04/01 14:39:55 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 2.37 2014/04/29 18:14:16 roberto Exp roberto $ |
3 | ** load precompiled Lua chunks | 3 | ** load precompiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -31,6 +31,7 @@ typedef struct { | |||
31 | ZIO *Z; | 31 | ZIO *Z; |
32 | Mbuffer *b; | 32 | Mbuffer *b; |
33 | const char *name; | 33 | const char *name; |
34 | TString *source; /* source (the same for all prototypes) */ | ||
34 | } LoadState; | 35 | } LoadState; |
35 | 36 | ||
36 | 37 | ||
@@ -167,7 +168,7 @@ static void LoadUpvalues (LoadState *S, Proto *f) { | |||
167 | 168 | ||
168 | static void LoadDebug (LoadState *S, Proto *f) { | 169 | static void LoadDebug (LoadState *S, Proto *f) { |
169 | int i, n; | 170 | int i, n; |
170 | f->source = LoadString(S); | 171 | f->source = S->source; |
171 | n = LoadInt(S); | 172 | n = LoadInt(S); |
172 | f->lineinfo = luaM_newvector(S->L, n, int); | 173 | f->lineinfo = luaM_newvector(S->L, n, int); |
173 | f->sizelineinfo = n; | 174 | f->sizelineinfo = n; |
@@ -258,6 +259,7 @@ Closure *luaU_undump(lua_State *L, ZIO *Z, Mbuffer *buff, | |||
258 | setclLvalue(L, L->top, cl); | 259 | setclLvalue(L, L->top, cl); |
259 | incr_top(L); | 260 | incr_top(L); |
260 | cl->l.p = luaF_newproto(L); | 261 | cl->l.p = luaF_newproto(L); |
262 | S.source = cl->l.p->source = LoadString(&S); /* read source */ | ||
261 | LoadFunction(&S, cl->l.p); | 263 | LoadFunction(&S, cl->l.p); |
262 | lua_assert(cl->l.nupvalues == cl->l.p->sizeupvalues); | 264 | lua_assert(cl->l.nupvalues == cl->l.p->sizeupvalues); |
263 | luai_verifycode(L, buff, cl->l.p); | 265 | luai_verifycode(L, buff, cl->l.p); |