summaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-10 15:37:44 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-10 15:37:44 -0300
commit73aa465a8ed8dee6c6a27a6f8b2f51227b70789d (patch)
tree496a63ffffe0312f1d0b9882d97944fa38ed7801 /lgc.c
parent3d0577f4b98908be3f2d697ab75c5fbbd3f6999b (diff)
downloadlua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.tar.gz
lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.tar.bz2
lua-73aa465a8ed8dee6c6a27a6f8b2f51227b70789d.zip
some name changes
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/lgc.c b/lgc.c
index 4fbe7230..87aa7d25 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.40 2000/01/25 13:57:18 roberto Exp roberto $ 2** $Id: lgc.c,v 1.41 2000/01/28 16:53:00 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*/
@@ -28,7 +28,7 @@ static int markobject (lua_State *L, TObject *o);
28 28
29 29
30 30
31static void protomark (lua_State *L, TProtoFunc *f) { 31static void protomark (lua_State *L, Proto *f) {
32 if (!f->marked) { 32 if (!f->marked) {
33 int i; 33 int i;
34 f->marked = 1; 34 f->marked = 1;
@@ -57,7 +57,7 @@ static void hashmark (lua_State *L, Hash *h) {
57 h->marked = 1; 57 h->marked = 1;
58 for (i=h->size-1; i>=0; i--) { 58 for (i=h->size-1; i>=0; i--) {
59 Node *n = node(h,i); 59 Node *n = node(h,i);
60 if (ttype(key(n)) != LUA_T_NIL) { 60 if (ttype(key(n)) != TAG_NIL) {
61 markobject(L, &n->key); 61 markobject(L, &n->key);
62 markobject(L, &n->val); 62 markobject(L, &n->val);
63 } 63 }
@@ -70,7 +70,7 @@ static void travglobal (lua_State *L) {
70 GlobalVar *gv; 70 GlobalVar *gv;
71 for (gv=L->rootglobal; gv; gv=gv->next) { 71 for (gv=L->rootglobal; gv; gv=gv->next) {
72 LUA_ASSERT(L, gv->name->u.s.gv == gv, "inconsistent global name"); 72 LUA_ASSERT(L, gv->name->u.s.gv == gv, "inconsistent global name");
73 if (gv->value.ttype != LUA_T_NIL) { 73 if (gv->value.ttype != TAG_NIL) {
74 strmark(L, gv->name); /* cannot collect non nil global variables */ 74 strmark(L, gv->name); /* cannot collect non nil global variables */
75 markobject(L, &gv->value); 75 markobject(L, &gv->value);
76 } 76 }
@@ -96,17 +96,17 @@ static void travlock (lua_State *L) {
96 96
97static int markobject (lua_State *L, TObject *o) { 97static int markobject (lua_State *L, TObject *o) {
98 switch (ttype(o)) { 98 switch (ttype(o)) {
99 case LUA_T_USERDATA: case LUA_T_STRING: 99 case TAG_USERDATA: case TAG_STRING:
100 strmark(L, tsvalue(o)); 100 strmark(L, tsvalue(o));
101 break; 101 break;
102 case LUA_T_ARRAY: 102 case TAG_ARRAY:
103 hashmark(L, avalue(o)); 103 hashmark(L, avalue(o));
104 break; 104 break;
105 case LUA_T_LCLOSURE: case LUA_T_LCLMARK: 105 case TAG_LCLOSURE: case TAG_LCLMARK:
106 case LUA_T_CCLOSURE: case LUA_T_CCLMARK: 106 case TAG_CCLOSURE: case TAG_CCLMARK:
107 closuremark(L, o->value.cl); 107 closuremark(L, o->value.cl);
108 break; 108 break;
109 case LUA_T_LPROTO: case LUA_T_LMARK: 109 case TAG_LPROTO: case TAG_LMARK:
110 protomark(L, o->value.tf); 110 protomark(L, o->value.tf);
111 break; 111 break;
112 default: break; /* numbers, cprotos, etc */ 112 default: break; /* numbers, cprotos, etc */
@@ -116,8 +116,8 @@ static int markobject (lua_State *L, TObject *o) {
116 116
117 117
118static void collectproto (lua_State *L) { 118static void collectproto (lua_State *L) {
119 TProtoFunc **p = &L->rootproto; 119 Proto **p = &L->rootproto;
120 TProtoFunc *next; 120 Proto *next;
121 while ((next = *p) != NULL) { 121 while ((next = *p) != NULL) {
122 if (next->marked) { 122 if (next->marked) {
123 next->marked = 0; 123 next->marked = 0;
@@ -185,14 +185,14 @@ static void clear_global_list (lua_State *L, int limit) {
185static void collectstring (lua_State *L, int limit) { 185static void collectstring (lua_State *L, int limit) {
186 TObject o; /* to call userdata `gc' tag method */ 186 TObject o; /* to call userdata `gc' tag method */
187 int i; 187 int i;
188 ttype(&o) = LUA_T_USERDATA; 188 ttype(&o) = TAG_USERDATA;
189 clear_global_list(L, limit); 189 clear_global_list(L, limit);
190 for (i=0; i<NUM_HASHS; i++) { /* for each hash table */ 190 for (i=0; i<NUM_HASHS; i++) { /* for each hash table */
191 stringtable *tb = &L->string_root[i]; 191 stringtable *tb = &L->string_root[i];
192 int j; 192 int j;
193 for (j=0; j<tb->size; j++) { /* for each list */ 193 for (j=0; j<tb->size; j++) { /* for each list */
194 TaggedString **p = &tb->hash[j]; 194 TString **p = &tb->hash[j];
195 TaggedString *next; 195 TString *next;
196 while ((next = *p) != NULL) { 196 while ((next = *p) != NULL) {
197 if (next->marked >= limit) { 197 if (next->marked >= limit) {
198 if (next->marked < FIXMARK) /* does not change FIXMARKs */ 198 if (next->marked < FIXMARK) /* does not change FIXMARKs */
@@ -220,7 +220,7 @@ static void collectstring (lua_State *L, int limit) {
220static void tableTM (lua_State *L) { 220static void tableTM (lua_State *L) {
221 Hash *p; 221 Hash *p;
222 TObject o; 222 TObject o;
223 ttype(&o) = LUA_T_ARRAY; 223 ttype(&o) = TAG_ARRAY;
224 for (p = L->roottable; p; p = p->next) { 224 for (p = L->roottable; p; p = p->next) {
225 if (!p->marked) { 225 if (!p->marked) {
226 avalue(&o) = p; 226 avalue(&o) = p;