Преглед на файлове

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

Roberto Ierusalimschy преди 26 години
родител
ревизия
e5743adb21
променени са 3 файла, в които са добавени 12 реда и са изтрити 12 реда
  1. 5 5
      lapi.c
  2. 3 3
      lgc.c
  3. 4 4
      ltable.h

+ 5 - 5
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 */
     }
   }

+ 3 - 3
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);
       }

+ 4 - 4
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)))