mirror of
https://github.com/lua/lua.git
synced 2024-11-30 21:53:26 +08:00
new constants LUA_NOREF and LUA_REFNIL.
This commit is contained in:
parent
21843f022a
commit
b44e35b773
6
lgc.c
6
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; 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
5
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;
|
||||
|
Loading…
Reference in New Issue
Block a user