From a69356e9e0a7525b1cebadc928a0efcce8c39b46 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 29 Mar 2000 17:19:20 -0300 Subject: no more special cases for closures with 0 upvalues (performance is the same, memory use a little higher, code much simpler). --- lfunc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lfunc.c') diff --git a/lfunc.c b/lfunc.c index 18ca5ca2..ffb456d5 100644 --- a/lfunc.c +++ b/lfunc.c @@ -1,5 +1,5 @@ /* -** $Id: lfunc.c,v 1.19 2000/03/03 14:58:26 roberto Exp roberto $ +** $Id: lfunc.c,v 1.20 2000/03/10 18:37:44 roberto Exp roberto $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ @@ -19,7 +19,8 @@ Closure *luaF_newclosure (lua_State *L, int nelems) { - Closure *c = (Closure *)luaM_malloc(L, sizeof(Closure)+nelems*sizeof(TObject)); + Closure *c = (Closure *)luaM_malloc(L, sizeof(Closure) + + sizeof(TObject)*(nelems-1)); c->next = L->rootcl; L->rootcl = c; c->marked = 0; -- cgit v1.2.3-55-g6feb