better names for `luaM_free...' macros

This commit is contained in:
Roberto Ierusalimschy 2004-11-24 17:20:21 -02:00
parent 1d99a7360b
commit 0e002005b1
5 changed files with 15 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: lfunc.c,v 2.3 2004/03/15 21:04:33 roberto Exp roberto $
** $Id: lfunc.c,v 2.4 2004/04/30 20:13:38 roberto Exp roberto $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/
@ -75,7 +75,7 @@ void luaF_close (lua_State *L, StkId level) {
lua_assert(!isblack(o));
L->openupval = uv->next; /* remove from `open' list */
if (isdead(g, o))
luaM_freelem(L, uv); /* free upvalue */
luaM_free(L, uv); /* free upvalue */
else {
setobj(L, &uv->value, uv->v);
uv->v = &uv->value; /* now current value lives here */
@ -117,14 +117,14 @@ void luaF_freeproto (lua_State *L, Proto *f) {
luaM_freearray(L, f->lineinfo, f->sizelineinfo, int);
luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar);
luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *);
luaM_freelem(L, f);
luaM_free(L, f);
}
void luaF_freeclosure (lua_State *L, Closure *c) {
int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) :
sizeLclosure(c->l.nupvalues);
luaM_free(L, c, size);
luaM_freemem(L, c, size);
}

8
lgc.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lgc.c,v 2.15 2004/11/19 15:52:40 roberto Exp roberto $
** $Id: lgc.c,v 2.16 2004/11/24 18:55:56 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@ -379,7 +379,7 @@ static void freeobj (lua_State *L, GCObject *o) {
switch (o->gch.tt) {
case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;
case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break;
case LUA_TUPVAL: luaM_freelem(L, gco2uv(o)); break;
case LUA_TUPVAL: luaM_free(L, gco2uv(o)); break;
case LUA_TTABLE: luaH_free(L, gco2h(o)); break;
case LUA_TTHREAD: {
lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread);
@ -388,11 +388,11 @@ static void freeobj (lua_State *L, GCObject *o) {
}
case LUA_TSTRING: {
G(L)->strt.nuse--;
luaM_free(L, o, sizestring(gco2ts(o)));
luaM_freemem(L, o, sizestring(gco2ts(o)));
break;
}
case LUA_TUSERDATA: {
luaM_free(L, o, sizeudata(gco2u(o)));
luaM_freemem(L, o, sizeudata(gco2u(o)));
break;
}
default: lua_assert(0);

6
lmem.h
View File

@ -1,5 +1,5 @@
/*
** $Id: lmem.h,v 1.26 2002/05/01 20:40:42 roberto Exp roberto $
** $Id: lmem.h,v 1.27 2004/11/19 15:52:40 roberto Exp roberto $
** Interface to Memory Manager
** See Copyright Notice in lua.h
*/
@ -29,8 +29,8 @@ void *luaM_toobig (lua_State *L);
void *luaM_growaux (lua_State *L, void *block, int *size, size_t size_elem,
int limit, const char *errormsg);
#define luaM_free(L, b, s) luaM_realloc(L, (b), (s), 0)
#define luaM_freelem(L, b) luaM_realloc(L, (b), sizeof(*(b)), 0)
#define luaM_freemem(L, b, s) luaM_realloc(L, (b), (s), 0)
#define luaM_free(L, b) luaM_realloc(L, (b), sizeof(*(b)), 0)
#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t))
#define luaM_malloc(L,t) luaM_realloc(L, NULL, 0, (t))

View File

@ -1,5 +1,5 @@
/*
** $Id: lstate.c,v 2.15 2004/10/06 18:34:16 roberto Exp roberto $
** $Id: lstate.c,v 2.16 2004/11/19 15:52:40 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@ -155,7 +155,7 @@ void luaE_freethread (lua_State *L, lua_State *L1) {
luaF_close(L1, L1->stack); /* close all upvalues for this thread */
lua_assert(L1->openupval == NULL);
freestack(L, L1);
luaM_free(L, fromstate(L1), state_size(lua_State));
luaM_freemem(L, fromstate(L1), state_size(lua_State));
}

View File

@ -1,5 +1,5 @@
/*
** $Id: ltable.c,v 2.8 2004/11/24 18:55:42 roberto Exp roberto $
** $Id: ltable.c,v 2.9 2004/11/24 19:16:03 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@ -335,7 +335,7 @@ void luaH_free (lua_State *L, Table *t) {
if (t->lsizenode)
luaM_freearray(L, t->node, sizenode(t), Node);
luaM_freearray(L, t->array, t->sizearray, TValue);
luaM_freelem(L, t);
luaM_free(L, t);
}