lua

A copy of the Lua development repository
Log | Files | Refs | README

commit e5743adb21c295e9903c394096c6f3737fb6dec4
parent 514783de9d6cd538d1a51aa8979b7763132730ac
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 23 Nov 1999 11:57:40 -0200

macros `key', `val', and `node' don't need the state

Diffstat:
Mlapi.c | 10+++++-----
Mlgc.c | 6+++---
Mltable.h | 8++++----
3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/lapi.c b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 1.56 1999/11/11 17:02:40 roberto Exp roberto $ +** $Id: lapi.c,v 1.57 1999/11/22 13:12:07 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -420,10 +420,10 @@ const char *lua_nextvar (lua_State *L, const char *varname) { int luaA_next (lua_State *L, const Hash *t, int i) { int tsize = t->size; for (; i<tsize; i++) { - Node *n = node(L, t, i); - if (ttype(val(L, n)) != LUA_T_NIL) { - luaA_pushobject(L, key(L, n)); - luaA_pushobject(L, val(L, n)); + Node *n = node(t, i); + if (ttype(val(n)) != LUA_T_NIL) { + luaA_pushobject(L, key(n)); + luaA_pushobject(L, val(n)); return i+1; /* index to be used next time */ } } diff --git a/lgc.c b/lgc.c @@ -1,5 +1,5 @@ /* -** $Id: lgc.c,v 1.31 1999/11/10 15:40:46 roberto Exp roberto $ +** $Id: lgc.c,v 1.32 1999/11/22 13:12:07 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -54,8 +54,8 @@ static void hashmark (lua_State *L, Hash *h) { int i; h->marked = 1; for (i=h->size-1; i>=0; i--) { - Node *n = node(L, h,i); - if (ttype(key(L, n)) != LUA_T_NIL) { + Node *n = node(h,i); + if (ttype(key(n)) != LUA_T_NIL) { markobject(L, &n->key); markobject(L, &n->val); } diff --git a/ltable.h b/ltable.h @@ -1,5 +1,5 @@ /* -** $Id: ltable.h,v 1.15 1999/10/26 10:53:40 roberto Exp roberto $ +** $Id: ltable.h,v 1.16 1999/11/22 13:12:07 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -10,9 +10,9 @@ #include "lobject.h" -#define node(L, t,i) (&(t)->node[i]) -#define key(L, n) (&(n)->key) -#define val(L, n) (&(n)->val) +#define node(t,i) (&(t)->node[i]) +#define key(n) (&(n)->key) +#define val(n) (&(n)->val) #define luaH_move(L, t,from,to) (luaH_setint(L, t, to, luaH_getint(L, t, from)))