summaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-10-16 17:40:58 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-10-16 17:40:58 -0300
commitc196348717dfda116726145220e5d1311547980e (patch)
tree83149c29559b888eed7a28e5f1558a67a912cf90 /lcode.c
parent669129a6d8210e758ba94ea2786a370946572f7d (diff)
downloadlua-c196348717dfda116726145220e5d1311547980e.tar.gz
lua-c196348717dfda116726145220e5d1311547980e.tar.bz2
lua-c196348717dfda116726145220e5d1311547980e.zip
in case of memory allocation errors, sizecode and sizelineinfo can
be different
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lcode.c b/lcode.c
index 118f16b3..e3420ac1 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 1.110 2002/08/20 20:03:05 roberto Exp roberto $ 2** $Id: lcode.c,v 1.111 2002/08/21 18:56:33 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -686,14 +686,14 @@ void luaK_fixline (FuncState *fs, int line) {
686 686
687int luaK_code (FuncState *fs, Instruction i, int line) { 687int luaK_code (FuncState *fs, Instruction i, int line) {
688 Proto *f = fs->f; 688 Proto *f = fs->f;
689 int oldsize = f->sizecode;
690 luaK_dischargejpc(fs); /* `pc' will change */ 689 luaK_dischargejpc(fs); /* `pc' will change */
691 /* put new instruction in code array */ 690 /* put new instruction in code array */
692 luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, 691 luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction,
693 MAX_INT, "code size overflow"); 692 MAX_INT, "code size overflow");
694 f->code[fs->pc] = i; 693 f->code[fs->pc] = i;
695 if (f->sizecode != oldsize) 694 /* save corresponding line information */
696 luaM_reallocvector(fs->L, f->lineinfo, oldsize, f->sizecode, int); 695 luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int,
696 MAX_INT, "code size overflow");
697 f->lineinfo[fs->pc] = line; 697 f->lineinfo[fs->pc] = line;
698 return fs->pc++; 698 return fs->pc++;
699} 699}