diff options
| -rw-r--r-- | lgc.c | 6 | ||||
| -rw-r--r-- | lua.h | 5 |
2 files changed, 7 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 1.22 1999/02/26 15:48:55 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.23 1999/03/04 21:17:26 roberto Exp roberto $ |
| 3 | ** Garbage Collector | 3 | ** Garbage Collector |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -32,7 +32,7 @@ static int markobject (TObject *o); | |||
| 32 | int luaC_ref (TObject *o, int lock) { | 32 | int luaC_ref (TObject *o, int lock) { |
| 33 | int ref; | 33 | int ref; |
| 34 | if (ttype(o) == LUA_T_NIL) | 34 | if (ttype(o) == LUA_T_NIL) |
| 35 | ref = -1; /* special ref for nil */ | 35 | ref = LUA_REFNIL; |
| 36 | else { | 36 | else { |
| 37 | for (ref=0; ref<L->refSize; ref++) | 37 | for (ref=0; ref<L->refSize; ref++) |
| 38 | if (L->refArray[ref].status == FREE) | 38 | if (L->refArray[ref].status == FREE) |
| @@ -57,7 +57,7 @@ void lua_unref (int ref) | |||
| 57 | 57 | ||
| 58 | TObject* luaC_getref (int ref) | 58 | TObject* luaC_getref (int ref) |
| 59 | { | 59 | { |
| 60 | if (ref == -1) | 60 | if (ref == LUA_REFNIL) |
| 61 | return &luaO_nilobject; | 61 | return &luaO_nilobject; |
| 62 | if (ref >= 0 && ref < L->refSize && | 62 | if (ref >= 0 && ref < L->refSize && |
| 63 | (L->refArray[ref].status == LOCK || L->refArray[ref].status == HOLD)) | 63 | (L->refArray[ref].status == LOCK || L->refArray[ref].status == HOLD)) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.31 1999/04/15 12:33:19 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.32 1999/05/11 20:29:19 roberto Exp roberto $ |
| 3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
| 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
| 5 | ** e-mail: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
| @@ -18,6 +18,9 @@ | |||
| 18 | 18 | ||
| 19 | #define LUA_NOOBJECT 0 | 19 | #define LUA_NOOBJECT 0 |
| 20 | 20 | ||
| 21 | #define LUA_NOREF (-2) | ||
| 22 | #define LUA_REFNIL (-1) | ||
| 23 | |||
| 21 | #define LUA_ANYTAG (-1) | 24 | #define LUA_ANYTAG (-1) |
| 22 | 25 | ||
| 23 | typedef struct lua_State lua_State; | 26 | typedef struct lua_State lua_State; |
