diff --git a/lgc.c b/lgc.c index 5686a296..66244fbf 100644 --- a/lgc.c +++ b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 1.22 1999/02/26 15:48:55 roberto Exp roberto $ +** $Id: lgc.c,v 1.23 1999/03/04 21:17:26 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -32,7 +32,7 @@ static int markobject (TObject *o); int luaC_ref (TObject *o, int lock) { int ref; if (ttype(o) == LUA_T_NIL) - ref = -1; /* special ref for nil */ + ref = LUA_REFNIL; else { for (ref=0; refrefSize; ref++) if (L->refArray[ref].status == FREE) @@ -57,7 +57,7 @@ void lua_unref (int ref) TObject* luaC_getref (int ref) { - if (ref == -1) + if (ref == LUA_REFNIL) return &luaO_nilobject; if (ref >= 0 && ref < L->refSize && (L->refArray[ref].status == LOCK || L->refArray[ref].status == HOLD)) diff --git a/lua.h b/lua.h index a8beb3cf..ddba13fa 100644 --- a/lua.h +++ b/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.31 1999/04/15 12:33:19 roberto Exp roberto $ +** $Id: lua.h,v 1.32 1999/05/11 20:29:19 roberto Exp roberto $ ** Lua - An Extensible Extension Language ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil ** e-mail: lua@tecgraf.puc-rio.br @@ -18,6 +18,9 @@ #define LUA_NOOBJECT 0 +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + #define LUA_ANYTAG (-1) typedef struct lua_State lua_State;