lua

A copy of the Lua development repository
Log | Files | Refs | README

commit d53e2d23861814c2361e75d4622b3784a993823f
parent cf9a22396c1050f22176fc1367a4e7e2e4e3abc8
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon, 27 Sep 1999 15:00:03 -0300

details

Diffstat:
Mlgc.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lgc.c b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 1.24 1999/08/11 17:00:59 roberto Exp roberto $ +** $Id: lgc.c,v 1.25 1999/08/16 20:52:00 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -143,10 +143,10 @@ static GCnode *listcollect (GCnode *l) { } -static void strmark (TaggedString *s) { - if (!s->head.marked) - s->head.marked = 1; -} +/* +** mark a string; marks bigger than 1 cannot be changed. +*/ +#define strmark(s) {if ((s)->head.marked == 0) (s)->head.marked = 1;} static void protomark (TProtoFunc *f) { @@ -154,7 +154,7 @@ static void protomark (TProtoFunc *f) { int i; f->head.marked = 1; strmark(f->source); - for (i=0; i<f->nconsts; i++) + for (i=f->nconsts-1; i>=0; i--) markobject(&f->consts[i]); } } @@ -174,7 +174,7 @@ static void hashmark (Hash *h) { if (!h->head.marked) { int i; h->head.marked = 1; - for (i=0; i<nhash(h); i++) { + for (i=nhash(h)-1; i>=0; i--) { Node *n = node(h,i); if (ttype(ref(n)) != LUA_T_NIL) { markobject(&n->ref);