浏览代码

IMtable must be initialized (and IMtable_size is not needed any more) due
to new way to handle growing vectors (previous modification).

Roberto Ierusalimschy 26 年之前
父节点
当前提交
cb7f027380
共有 2 个文件被更改,包括 8 次插入8 次删除
  1. 7 6
      lstate.c
  2. 1 2
      lstate.h

+ 7 - 6
lstate.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstate.c,v 1.8 1999/02/04 17:47:59 roberto Exp roberto $
+** $Id: lstate.c,v 1.9 1999/02/25 15:17:01 roberto Exp roberto $
 ** Global State
 ** See Copyright Notice in lua.h
 */
@@ -24,11 +24,15 @@ void lua_open (void)
 {
   if (lua_state) return;
   lua_state = luaM_new(lua_State);
-  L->numCblocks = 0;
   L->Cstack.base = 0;
   L->Cstack.lua2C = 0;
   L->Cstack.num = 0;
   L->errorJmp = NULL;
+  L->Mbuffer = NULL;
+  L->Mbuffbase = 0;
+  L->Mbuffsize = 0;
+  L->Mbuffnext = 0;
+  L->numCblocks = 0;
   L->debug = 0;
   L->callhook = NULL;
   L->linehook = NULL;
@@ -40,12 +44,9 @@ void lua_open (void)
   L->rootglobal.marked = 0;
   L->roottable.next = NULL;
   L->roottable.marked = 0;
+  L->IMtable = NULL;
   L->refArray = NULL;
   L->refSize = 0;
-  L->Mbuffsize = 0;
-  L->Mbuffnext = 0;
-  L->Mbuffbase = 0;
-  L->Mbuffer = NULL;
   L->GCthreshold = GARBAGE_BLOCK;
   L->nblocks = 0;
   luaD_init();

+ 1 - 2
lstate.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lstate.h,v 1.14 1999/02/04 17:47:59 roberto Exp roberto $
+** $Id: lstate.h,v 1.15 1999/02/25 15:17:01 roberto Exp roberto $
 ** Global State
 ** See Copyright Notice in lua.h
 */
@@ -71,7 +71,6 @@ struct lua_State {
   GCnode rootglobal;  /* list of strings with global values */
   stringtable *string_root;  /* array of hash tables for strings and udata */
   struct IM *IMtable;  /* table for tag methods */
-  int IMtable_size;  /* size of IMtable */
   int last_tag;  /* last used tag in IMtable */
   struct ref *refArray;  /* locked objects */
   int refSize;  /* size of refArray */