aboutsummaryrefslogtreecommitdiff
path: root/lundump.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-06-18 10:21:12 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-06-18 10:21:12 -0300
commit94266dfdbd25b43fb84e6dc7752cdb069f0335e9 (patch)
tree713bcc5719fcd2f5a360d6135dcbaabbf14f07ae /lundump.c
parente3871abe95446658383ec3576f473a5f1005736e (diff)
downloadlua-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
Diffstat (limited to 'lundump.c')
-rw-r--r--lundump.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lundump.c b/lundump.c
index b0c31c78..ffc8853b 100644
--- a/lundump.c
+++ b/lundump.c
@@ -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
168static void LoadDebug (LoadState *S, Proto *f) { 169static 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);