new constants LUA_NOREF and LUA_REFNIL.

This commit is contained in:
Roberto Ierusalimschy 1999-08-11 14:00:59 -03:00
parent 21843f022a
commit b44e35b773
2 changed files with 7 additions and 4 deletions

6
lgc.c
View File

@ -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; ref<L->refSize; 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))

5
lua.h
View File

@ -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;