diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-02-10 11:25:02 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-02-10 11:25:02 -0200 |
commit | 4df8800a01c7e44800ce59339c66b9257cd75c2a (patch) | |
tree | 226ae5cfc06164f6f01e33d778336c1ffd561d72 /lfunc.c | |
parent | 0e60572606684458b18febfcef0bc68235b461f4 (diff) | |
download | lua-4df8800a01c7e44800ce59339c66b9257cd75c2a.tar.gz lua-4df8800a01c7e44800ce59339c66b9257cd75c2a.tar.bz2 lua-4df8800a01c7e44800ce59339c66b9257cd75c2a.zip |
cleaner way to free all objects
Diffstat (limited to 'lfunc.c')
-rw-r--r-- | lfunc.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lfunc.c,v 2.5 2004/11/24 19:20:21 roberto Exp $ | 2 | ** $Id: lfunc.c,v 2.7 2005/01/19 15:54:26 roberto Exp roberto $ |
3 | ** Auxiliary functions to manipulate prototypes and closures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -57,7 +57,7 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { | |||
57 | while ((p = ngcotouv(*pp)) != NULL && p->v >= level) { | 57 | while ((p = ngcotouv(*pp)) != NULL && p->v >= level) { |
58 | lua_assert(p->v != &p->u.value); | 58 | lua_assert(p->v != &p->u.value); |
59 | if (p->v == level) { /* found a corresponding upvalue? */ | 59 | if (p->v == level) { /* found a corresponding upvalue? */ |
60 | if (isdead(G(L), obj2gco(p))) /* is it dead? */ | 60 | if (isdead(g, obj2gco(p))) /* is it dead? */ |
61 | changewhite(obj2gco(p)); /* ressurect it */ | 61 | changewhite(obj2gco(p)); /* ressurect it */ |
62 | return p; | 62 | return p; |
63 | } | 63 | } |
@@ -106,7 +106,7 @@ void luaF_close (lua_State *L, StkId level) { | |||
106 | setobj(L, &uv->u.value, uv->v); | 106 | setobj(L, &uv->u.value, uv->v); |
107 | if (isgray(o)) { | 107 | if (isgray(o)) { |
108 | gray2black(o); /* closed upvalues are never gray */ | 108 | gray2black(o); /* closed upvalues are never gray */ |
109 | luaC_barrier(L, uv, uv->v); | 109 | luaC_barrier(L, uv, &uv->u.value); |
110 | } | 110 | } |
111 | uv->v = &uv->u.value; /* now current value lives here */ | 111 | uv->v = &uv->u.value; /* now current value lives here */ |
112 | luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ | 112 | luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ |