avoid clashing names between macros and fields

This commit is contained in:
Roberto Ierusalimschy 2001-11-29 18:21:46 -02:00
parent 72659a0605
commit fca0a12e23
3 changed files with 7 additions and 7 deletions

View File

@ -172,8 +172,8 @@ static void numuse (const Table *t, int *narray, int *nhash) {
/* count elements in hash part */ /* count elements in hash part */
i = sizenode(t); i = sizenode(t);
while (i--) { while (i--) {
if (ttype(&t->node[i].val) != LUA_TNIL) { if (ttype(val(&t->node[i])) != LUA_TNIL) {
int k = arrayindex(&t->node[i].key); int k = arrayindex(key(&t->node[i]));
if (k >= 0) /* is `key' an appropriate array index? */ if (k >= 0) /* is `key' an appropriate array index? */
nums[luaO_log2(k-1)+1]++; /* count as such */ nums[luaO_log2(k-1)+1]++; /* count as such */
totaluse++; totaluse++;

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ltable.h,v 1.36 2001/08/31 19:46:07 roberto Exp $ ** $Id: ltable.h,v 1.37 2001/10/25 19:14:14 roberto Exp $
** Lua tables (hash) ** Lua tables (hash)
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -10,9 +10,9 @@
#include "lobject.h" #include "lobject.h"
#define node(_t,_i) (&(_t)->node[_i]) #define node(t,i) (&(t)->node[i])
#define key(_n) (&(_n)->key) #define key(n) (&(n)->_key)
#define val(_n) (&(_n)->val) #define val(n) (&(n)->_val)
#define settableval(p,v) setobj(cast(TObject *, p), v) #define settableval(p,v) setobj(cast(TObject *, p), v)

View File

@ -277,7 +277,7 @@ static int table_query (lua_State *L) {
} }
else else
lua_pushstring(L, "<undef>"); lua_pushstring(L, "<undef>");
luaA_pushobject(L, &t->node[i].val); luaA_pushobject(L, val(&t->node[i]));
if (t->node[i].next) if (t->node[i].next)
lua_pushnumber(L, t->node[i].next - t->node); lua_pushnumber(L, t->node[i].next - t->node);
else else