summaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lgc.c b/lgc.c
index 286b2213..7a3df48a 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.64 2009/12/11 19:14:59 roberto Exp roberto $ 2** $Id: lgc.c,v 2.65 2009/12/11 21:31:14 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*/
@@ -116,12 +116,20 @@ void luaC_barrierback (lua_State *L, Table *t) {
116} 116}
117 117
118 118
119void luaC_link (lua_State *L, GCObject *o, lu_byte tt) { 119/*
120** create a new collectable object and link it to '*list'
121*/
122GCObject *luaC_newobj (lua_State *L, int tt, size_t sz, GCObject **list,
123 int offset) {
120 global_State *g = G(L); 124 global_State *g = G(L);
125 GCObject *o = obj2gco(cast(char *, luaM_newobject(L, tt, sz)) + offset);
126 if (list == NULL)
127 list = &g->rootgc; /* standard list for collectable objects */
121 gch(o)->marked = luaC_white(g); 128 gch(o)->marked = luaC_white(g);
122 gch(o)->tt = tt; 129 gch(o)->tt = tt;
123 gch(o)->next = g->rootgc; 130 gch(o)->next = *list;
124 g->rootgc = o; 131 *list = o;
132 return o;
125} 133}
126 134
127 135