diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-09-11 09:26:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-09-11 09:26:14 -0300 |
commit | 115087344797d0aafb23f4fe5b902fdebd2c3310 (patch) | |
tree | 732c83cee53b9d67b83cebfc2e5debd30d48eeed /lgc.c | |
parent | 79ab21be90792c00da98e5ec3d55c8a082c6e6de (diff) | |
download | lua-115087344797d0aafb23f4fe5b902fdebd2c3310.tar.gz lua-115087344797d0aafb23f4fe5b902fdebd2c3310.tar.bz2 lua-115087344797d0aafb23f4fe5b902fdebd2c3310.zip |
'luaC_newobj' does not handle special cases; only special case
now is threads, which do not use 'luaC_newobj' anymore.
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.157 2013/08/30 19:14:26 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.158 2013/09/03 15:37:10 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 | */ |
@@ -200,22 +200,15 @@ void luaC_fix (lua_State *L, GCObject *o) { | |||
200 | 200 | ||
201 | /* | 201 | /* |
202 | ** create a new collectable object (with given type and size) and link | 202 | ** create a new collectable object (with given type and size) and link |
203 | ** it to '*list'. 'offset' tells how many bytes to allocate before the | 203 | ** it to 'localgc' list. |
204 | ** object itself (used only by states). | ||
205 | */ | 204 | */ |
206 | GCObject *luaC_newobj (lua_State *L, int tt, size_t sz, GCObject **list, | 205 | GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { |
207 | int offset) { | ||
208 | global_State *g = G(L); | 206 | global_State *g = G(L); |
209 | char *raw = cast(char *, luaM_newobject(L, novariant(tt), sz)); | 207 | GCObject *o = cast(GCObject *, luaM_newobject(L, novariant(tt), sz)); |
210 | GCObject *o = obj2gco(raw + offset); | ||
211 | gch(o)->marked = luaC_white(g); | 208 | gch(o)->marked = luaC_white(g); |
212 | if (list == NULL) | ||
213 | list = &g->localgc; /* standard list for collectable objects */ | ||
214 | else | ||
215 | l_setbit(gch(o)->marked, LOCALMARK); /* mark object as not in 'localgc' */ | ||
216 | gch(o)->tt = tt; | 209 | gch(o)->tt = tt; |
217 | gch(o)->next = *list; | 210 | gch(o)->next = g->localgc; |
218 | *list = o; | 211 | g->localgc = o; |
219 | return o; | 212 | return o; |
220 | } | 213 | } |
221 | 214 | ||