diff options
Diffstat (limited to 'lfunc.c')
| -rw-r--r-- | lfunc.c | 21 |
1 files changed, 5 insertions, 16 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: $ | 2 | ** $Id: lfunc.c,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $ |
| 3 | ** Lua Funcion auxiliar | 3 | ** Lua Funcion auxiliar |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -11,26 +11,15 @@ | |||
| 11 | #include "lmem.h" | 11 | #include "lmem.h" |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | TProtoFunc *luaF_root = NULL; | 14 | GCnode luaF_root = {NULL, 0}; |
| 15 | Closure *luaF_rootcl = NULL; | 15 | GCnode luaF_rootcl = {NULL, 0}; |
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | static void luaI_insertfunction (TProtoFunc *f) | ||
| 19 | { | ||
| 20 | ++luaO_nentities; | ||
| 21 | f->head.next = (GCnode *)luaF_root; | ||
| 22 | luaF_root = f; | ||
| 23 | f->head.marked = 0; | ||
| 24 | } | ||
| 25 | |||
| 26 | 18 | ||
| 27 | Closure *luaF_newclosure (int nelems) | 19 | Closure *luaF_newclosure (int nelems) |
| 28 | { | 20 | { |
| 29 | Closure *c = (Closure *)luaM_malloc(sizeof(Closure)+nelems*sizeof(TObject)); | 21 | Closure *c = (Closure *)luaM_malloc(sizeof(Closure)+nelems*sizeof(TObject)); |
| 30 | ++luaO_nentities; | 22 | luaO_insertlist(&luaF_rootcl, (GCnode *)c); |
| 31 | c->head.next = (GCnode *)luaF_rootcl; | ||
| 32 | luaF_rootcl = c; | ||
| 33 | c->head.marked = 0; | ||
| 34 | return c; | 23 | return c; |
| 35 | } | 24 | } |
| 36 | 25 | ||
| @@ -45,7 +34,7 @@ TProtoFunc *luaF_newproto (void) | |||
| 45 | f->nconsts = 0; | 34 | f->nconsts = 0; |
| 46 | f->nupvalues = 0; | 35 | f->nupvalues = 0; |
| 47 | f->locvars = NULL; | 36 | f->locvars = NULL; |
| 48 | luaI_insertfunction(f); | 37 | luaO_insertlist(&luaF_root, (GCnode *)f); |
| 49 | return f; | 38 | return f; |
| 50 | } | 39 | } |
| 51 | 40 | ||
