Răsfoiți Sursa

avoid clashing names between macros and fields

Roberto Ierusalimschy 24 ani în urmă
părinte
comite
fca0a12e23
3 a modificat fișierele cu 7 adăugiri și 7 ștergeri
  1. 2 2
      ltable.c
  2. 4 4
      ltable.h
  3. 1 1
      ltests.c

+ 2 - 2
ltable.c

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

+ 4 - 4
ltable.h

@@ -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)
 ** See Copyright Notice in lua.h
 */
@@ -10,9 +10,9 @@
 #include "lobject.h"
 
 
-#define node(_t,_i)	(&(_t)->node[_i])
-#define key(_n)		(&(_n)->key)
-#define val(_n)		(&(_n)->val)
+#define node(t,i)	(&(t)->node[i])
+#define key(n)		(&(n)->_key)
+#define val(n)		(&(n)->_val)
 
 #define settableval(p,v)	setobj(cast(TObject *, p), v)
 

+ 1 - 1
ltests.c

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