diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-11-24 17:20:21 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-11-24 17:20:21 -0200 |
| commit | 0e002005b1bf17e962d4640ef7b9fae900514f1a (patch) | |
| tree | c68a025d99d1dfa7a033baa765ba701909d8a4fb | |
| parent | 1d99a7360beaf1a50a3739413b1ad6ed4b71491d (diff) | |
| download | lua-0e002005b1bf17e962d4640ef7b9fae900514f1a.tar.gz lua-0e002005b1bf17e962d4640ef7b9fae900514f1a.tar.bz2 lua-0e002005b1bf17e962d4640ef7b9fae900514f1a.zip | |
better names for `luaM_free...' macros
| -rw-r--r-- | lfunc.c | 8 | ||||
| -rw-r--r-- | lgc.c | 8 | ||||
| -rw-r--r-- | lmem.h | 6 | ||||
| -rw-r--r-- | lstate.c | 4 | ||||
| -rw-r--r-- | ltable.c | 4 |
5 files changed, 15 insertions, 15 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lfunc.c,v 2.3 2004/03/15 21:04:33 roberto Exp roberto $ | 2 | ** $Id: lfunc.c,v 2.4 2004/04/30 20:13:38 roberto Exp roberto $ |
| 3 | ** Auxiliary functions to manipulate prototypes and closures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -75,7 +75,7 @@ void luaF_close (lua_State *L, StkId level) { | |||
| 75 | lua_assert(!isblack(o)); | 75 | lua_assert(!isblack(o)); |
| 76 | L->openupval = uv->next; /* remove from `open' list */ | 76 | L->openupval = uv->next; /* remove from `open' list */ |
| 77 | if (isdead(g, o)) | 77 | if (isdead(g, o)) |
| 78 | luaM_freelem(L, uv); /* free upvalue */ | 78 | luaM_free(L, uv); /* free upvalue */ |
| 79 | else { | 79 | else { |
| 80 | setobj(L, &uv->value, uv->v); | 80 | setobj(L, &uv->value, uv->v); |
| 81 | uv->v = &uv->value; /* now current value lives here */ | 81 | uv->v = &uv->value; /* now current value lives here */ |
| @@ -117,14 +117,14 @@ void luaF_freeproto (lua_State *L, Proto *f) { | |||
| 117 | luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); | 117 | luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); |
| 118 | luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); | 118 | luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); |
| 119 | luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); | 119 | luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); |
| 120 | luaM_freelem(L, f); | 120 | luaM_free(L, f); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | 123 | ||
| 124 | void luaF_freeclosure (lua_State *L, Closure *c) { | 124 | void luaF_freeclosure (lua_State *L, Closure *c) { |
| 125 | int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : | 125 | int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : |
| 126 | sizeLclosure(c->l.nupvalues); | 126 | sizeLclosure(c->l.nupvalues); |
| 127 | luaM_free(L, c, size); | 127 | luaM_freemem(L, c, size); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | 130 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 2.15 2004/11/19 15:52:40 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.16 2004/11/24 18:55:56 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 | */ |
| @@ -379,7 +379,7 @@ static void freeobj (lua_State *L, GCObject *o) { | |||
| 379 | switch (o->gch.tt) { | 379 | switch (o->gch.tt) { |
| 380 | case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; | 380 | case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; |
| 381 | case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; | 381 | case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; |
| 382 | case LUA_TUPVAL: luaM_freelem(L, gco2uv(o)); break; | 382 | case LUA_TUPVAL: luaM_free(L, gco2uv(o)); break; |
| 383 | case LUA_TTABLE: luaH_free(L, gco2h(o)); break; | 383 | case LUA_TTABLE: luaH_free(L, gco2h(o)); break; |
| 384 | case LUA_TTHREAD: { | 384 | case LUA_TTHREAD: { |
| 385 | lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread); | 385 | lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread); |
| @@ -388,11 +388,11 @@ static void freeobj (lua_State *L, GCObject *o) { | |||
| 388 | } | 388 | } |
| 389 | case LUA_TSTRING: { | 389 | case LUA_TSTRING: { |
| 390 | G(L)->strt.nuse--; | 390 | G(L)->strt.nuse--; |
| 391 | luaM_free(L, o, sizestring(gco2ts(o))); | 391 | luaM_freemem(L, o, sizestring(gco2ts(o))); |
| 392 | break; | 392 | break; |
| 393 | } | 393 | } |
| 394 | case LUA_TUSERDATA: { | 394 | case LUA_TUSERDATA: { |
| 395 | luaM_free(L, o, sizeudata(gco2u(o))); | 395 | luaM_freemem(L, o, sizeudata(gco2u(o))); |
| 396 | break; | 396 | break; |
| 397 | } | 397 | } |
| 398 | default: lua_assert(0); | 398 | default: lua_assert(0); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.h,v 1.26 2002/05/01 20:40:42 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.27 2004/11/19 15:52:40 roberto Exp roberto $ |
| 3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -29,8 +29,8 @@ void *luaM_toobig (lua_State *L); | |||
| 29 | void *luaM_growaux (lua_State *L, void *block, int *size, size_t size_elem, | 29 | void *luaM_growaux (lua_State *L, void *block, int *size, size_t size_elem, |
| 30 | int limit, const char *errormsg); | 30 | int limit, const char *errormsg); |
| 31 | 31 | ||
| 32 | #define luaM_free(L, b, s) luaM_realloc(L, (b), (s), 0) | 32 | #define luaM_freemem(L, b, s) luaM_realloc(L, (b), (s), 0) |
| 33 | #define luaM_freelem(L, b) luaM_realloc(L, (b), sizeof(*(b)), 0) | 33 | #define luaM_free(L, b) luaM_realloc(L, (b), sizeof(*(b)), 0) |
| 34 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) | 34 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) |
| 35 | 35 | ||
| 36 | #define luaM_malloc(L,t) luaM_realloc(L, NULL, 0, (t)) | 36 | #define luaM_malloc(L,t) luaM_realloc(L, NULL, 0, (t)) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.c,v 2.15 2004/10/06 18:34:16 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.16 2004/11/19 15:52:40 roberto Exp roberto $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -155,7 +155,7 @@ void luaE_freethread (lua_State *L, lua_State *L1) { | |||
| 155 | luaF_close(L1, L1->stack); /* close all upvalues for this thread */ | 155 | luaF_close(L1, L1->stack); /* close all upvalues for this thread */ |
| 156 | lua_assert(L1->openupval == NULL); | 156 | lua_assert(L1->openupval == NULL); |
| 157 | freestack(L, L1); | 157 | freestack(L, L1); |
| 158 | luaM_free(L, fromstate(L1), state_size(lua_State)); | 158 | luaM_freemem(L, fromstate(L1), state_size(lua_State)); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | 161 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 2.8 2004/11/24 18:55:42 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.9 2004/11/24 19:16:03 roberto Exp roberto $ |
| 3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -335,7 +335,7 @@ void luaH_free (lua_State *L, Table *t) { | |||
| 335 | if (t->lsizenode) | 335 | if (t->lsizenode) |
| 336 | luaM_freearray(L, t->node, sizenode(t), Node); | 336 | luaM_freearray(L, t->node, sizenode(t), Node); |
| 337 | luaM_freearray(L, t->array, t->sizearray, TValue); | 337 | luaM_freearray(L, t->array, t->sizearray, TValue); |
| 338 | luaM_freelem(L, t); | 338 | luaM_free(L, t); |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | 341 | ||
