diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-09-26 13:46:20 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-09-26 13:46:20 -0300 |
| commit | eb617df2d87f8476e722ade7319998d7912a6edf (patch) | |
| tree | 25d2635a076263518cdbb7da1693b674e0a4541e /lfunc.c | |
| parent | a580480b07cdf7201306b246deeb2fe84f2c25a9 (diff) | |
| download | lua-github-eb617df2d87f8476e722ade7319998d7912a6edf.tar.gz | |
better way to traverse GCnode lists.
Diffstat (limited to 'lfunc.c')
| -rw-r--r-- | lfunc.c | 21 |
1 files changed, 5 insertions, 16 deletions
@@ -1,5 +1,5 @@ /* -** $Id: $ +** $Id: lfunc.c,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $ ** Lua Funcion auxiliar ** See Copyright Notice in lua.h */ @@ -11,26 +11,15 @@ #include "lmem.h" -TProtoFunc *luaF_root = NULL; -Closure *luaF_rootcl = NULL; +GCnode luaF_root = {NULL, 0}; +GCnode luaF_rootcl = {NULL, 0}; -static void luaI_insertfunction (TProtoFunc *f) -{ - ++luaO_nentities; - f->head.next = (GCnode *)luaF_root; - luaF_root = f; - f->head.marked = 0; -} - Closure *luaF_newclosure (int nelems) { Closure *c = (Closure *)luaM_malloc(sizeof(Closure)+nelems*sizeof(TObject)); - ++luaO_nentities; - c->head.next = (GCnode *)luaF_rootcl; - luaF_rootcl = c; - c->head.marked = 0; + luaO_insertlist(&luaF_rootcl, (GCnode *)c); return c; } @@ -45,7 +34,7 @@ TProtoFunc *luaF_newproto (void) f->nconsts = 0; f->nupvalues = 0; f->locvars = NULL; - luaI_insertfunction(f); + luaO_insertlist(&luaF_root, (GCnode *)f); return f; } |
