diff --git a/lgc.c b/lgc.c index 2988467c..c9c6628c 100644 --- a/lgc.c +++ b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 2.76 2010/04/02 14:37:41 roberto Exp roberto $ +** $Id: lgc.c,v 2.77 2010/04/05 14:15:35 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -213,7 +213,7 @@ static void reallymarkobject (global_State *g, GCObject *o) { static void markmt (global_State *g) { int i; - for (i=0; imt[i]); } diff --git a/lobject.h b/lobject.h index 8ea1c830..ce8e9e26 100644 --- a/lobject.h +++ b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.35 2010/03/12 19:14:06 roberto Exp roberto $ +** $Id: lobject.h,v 2.36 2010/03/26 20:58:11 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -16,18 +16,12 @@ #include "lua.h" -/* tags for values visible from Lua */ -#define LAST_TAG LUA_TTHREAD - -#define NUM_TAGS (LAST_TAG+1) - - /* ** Extra tags for non-values */ -#define LUA_TPROTO (LAST_TAG+1) -#define LUA_TUPVAL (LAST_TAG+2) -#define LUA_TDEADKEY (LAST_TAG+3) +#define LUA_TPROTO LUA_NUMTAGS +#define LUA_TUPVAL (LUA_NUMTAGS+1) +#define LUA_TDEADKEY (LUA_NUMTAGS+2) /* diff --git a/lstate.c b/lstate.c index 0d88c960..6be44a9b 100644 --- a/lstate.c +++ b/lstate.c @@ -1,5 +1,5 @@ /* -** $Id: lstate.c,v 2.77 2010/04/05 16:35:37 roberto Exp roberto $ +** $Id: lstate.c,v 2.78 2010/04/08 17:16:46 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -268,7 +268,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { g->totalbytes = sizeof(LG); g->gcpause = LUAI_GCPAUSE; g->gcstepmul = LUAI_GCMUL; - for (i=0; imt[i] = NULL; + for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { /* memory allocation error: free partial state */ close_state(L); diff --git a/lstate.h b/lstate.h index 17cf2e06..fc496b12 100644 --- a/lstate.h +++ b/lstate.h @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 2.60 2010/04/05 16:35:37 roberto Exp roberto $ +** $Id: lstate.h,v 2.61 2010/04/08 17:16:46 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -144,7 +144,7 @@ typedef struct global_State { const lua_Number *version; /* pointer to version number */ TString *memerrmsg; /* memory-error message */ TString *tmname[TM_N]; /* array with tag-method names */ - struct Table *mt[NUM_TAGS]; /* metatables for basic types */ + struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ } global_State; diff --git a/ltests.h b/ltests.h index 7416a941..27dd9836 100644 --- a/ltests.h +++ b/ltests.h @@ -1,5 +1,5 @@ /* -** $Id: ltests.h,v 2.29 2009/12/17 12:26:09 roberto Exp roberto $ +** $Id: ltests.h,v 2.30 2010/01/11 17:33:09 roberto Exp roberto $ ** Internal Header for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -30,7 +30,7 @@ typedef struct Memcontrol { unsigned long total; unsigned long maxmem; unsigned long memlimit; - unsigned long objcount[5]; + unsigned long objcount[LUA_NUMTAGS]; } Memcontrol; extern Memcontrol l_memcontrol; diff --git a/lua.h b/lua.h index 454c49da..1fb67628 100644 --- a/lua.h +++ b/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.265 2010/03/26 20:58:11 roberto Exp roberto $ +** $Id: lua.h,v 1.266 2010/04/02 15:19:19 roberto Exp roberto $ ** Lua - A Scripting Language ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) ** See Copyright Notice at the end of this file @@ -81,6 +81,8 @@ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); #define LUA_TUSERDATA 7 #define LUA_TTHREAD 8 +#define LUA_NUMTAGS 9 + /* minimum Lua stack available to a C function */