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

remove dummy argument in LUA_ASSERT

Roberto Ierusalimschy преди 25 години
родител
ревизия
cfba572076
променени са 12 файла, в които са добавени 62 реда и са изтрити 62 реда
  1. 2 2
      lbuiltin.c
  2. 8 8
      lcode.c
  3. 9 9
      ldebug.c
  4. 2 2
      lgc.c
  5. 2 2
      lobject.c
  6. 5 5
      lobject.h
  7. 7 7
      lparser.c
  8. 3 3
      lref.c
  9. 9 9
      lstate.c
  10. 4 4
      lstring.c
  11. 4 4
      ltable.c
  12. 7 7
      lvm.c

+ 2 - 2
lbuiltin.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lbuiltin.c,v 1.115 2000/06/08 17:48:31 roberto Exp roberto $
+** $Id: lbuiltin.c,v 1.116 2000/06/12 13:52:05 roberto Exp roberto $
 ** Built-in functions
 ** See Copyright Notice in lua.h
 */
@@ -372,7 +372,7 @@ void luaB_tostring (lua_State *L) {
       lua_pushstring(L, "nil");
       return;
     default:
-      LUA_INTERNALERROR(L, "invalid type");
+      LUA_INTERNALERROR("invalid type");
   }
   lua_pushstring(L, buff);
 }

+ 8 - 8
lcode.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.c,v 1.39 2000/06/26 19:28:31 roberto Exp roberto $
+** $Id: lcode.c,v 1.40 2000/06/28 20:20:36 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -191,7 +191,7 @@ void luaK_storevar (LexState *ls, const expdesc *var) {
       luaK_code2(fs, OP_SETTABLE, 3, 3);
       break;
     default:
-      LUA_INTERNALERROR(ls->L, "invalid var kind to store");
+      LUA_INTERNALERROR("invalid var kind to store");
   }
 }
 
@@ -207,7 +207,7 @@ static OpCode invertjump (OpCode op) {
     case OP_JMPT: case OP_JMPONT:  return OP_JMPF;
     case OP_JMPF: case OP_JMPONF:  return OP_JMPT;
     default:
-      LUA_INTERNALERROR(NULL, "invalid jump instruction");
+      LUA_INTERNALERROR("invalid jump instruction");
       return OP_END;  /* to avoid warnings */
   }
 }
@@ -282,7 +282,7 @@ static void luaK_testgo (FuncState *fs, expdesc *v, int invert, OpCode jump) {
   discharge1(fs, v);
   prevpos = fs->pc-1;
   previous = &fs->f->code[prevpos];
-  LUA_ASSERT(L, *previous==previous_instruction(fs), "no jump allowed here");
+  LUA_ASSERT(*previous==previous_instruction(fs), "no jump allowed here");
   if (!ISJUMP(GET_OPCODE(*previous)))
     prevpos = luaK_code1(fs, jump, NO_JUMP);
   else {  /* last instruction is already a jump */
@@ -382,13 +382,13 @@ void luaK_infix (LexState *ls, int op, expdesc *v) {
 void luaK_posfix (LexState *ls, int op, expdesc *v1, expdesc *v2) {
   FuncState *fs = ls->fs;
   if (op == TK_AND) {
-    LUA_ASSERT(ls->L, v1->u.l.t == NO_JUMP, "list must be closed");
+    LUA_ASSERT(v1->u.l.t == NO_JUMP, "list must be closed");
     discharge1(fs, v2);
     v1->u.l.t = v2->u.l.t;
     luaK_concat(fs, &v1->u.l.f, v2->u.l.f);
   }
   else if (op == TK_OR) {
-    LUA_ASSERT(ls->L, v1->u.l.f == NO_JUMP, "list must be closed");
+    LUA_ASSERT(v1->u.l.f == NO_JUMP, "list must be closed");
     discharge1(fs, v2);
     v1->u.l.f = v2->u.l.f;
     luaK_concat(fs, &v1->u.l.t, v2->u.l.t);
@@ -598,11 +598,11 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) {
     case OP_GETINDEXED:
     case OP_TAILCALL:
     case OP_ADDI: {
-      LUA_INTERNALERROR(L, "instruction used only for optimizations");
+      LUA_INTERNALERROR("instruction used only for optimizations");
       break;
     }
     default: {
-      LUA_ASSERT(L, delta != VD, "invalid delta");
+      LUA_ASSERT(delta != VD, "invalid delta");
       break;
     }
   }

+ 9 - 9
ldebug.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldebug.c,v 1.25 2000/06/28 20:20:36 roberto Exp roberto $
+** $Id: ldebug.c,v 1.26 2000/06/30 14:29:35 roberto Exp roberto $
 ** Debug Interface
 ** See Copyright Notice in lua.h
 */
@@ -101,7 +101,7 @@ static int lua_nups (StkId f) {
 
 static int lua_currentpc (StkId f) {
   CallInfo *ci = infovalue(f);
-  LUA_ASSERT(L, ttype(f) == TAG_LMARK, "function has no pc");
+  LUA_ASSERT(ttype(f) == TAG_LMARK, "function has no pc");
   return (*ci->pc - 1) - ci->func->f.l->code;
 }
 
@@ -165,7 +165,7 @@ static void lua_funcinfo (lua_Debug *ar, StkId func) {
       ar->what = "C";
       break;
     default:
-      LUA_INTERNALERROR(L, "invalid `func' value");
+      LUA_INTERNALERROR("invalid `func' value");
   }
   if (ar->linedefined == 0)
     ar->what = "main";
@@ -245,24 +245,24 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int stackpos) {
     top++;  /* `arg' */
   while (pc < lastpc) {
     const Instruction i = code[pc++];
-    LUA_ASSERT(NULL, top <= pt->maxstacksize, "wrong stack");
+    LUA_ASSERT(top <= pt->maxstacksize, "wrong stack");
     switch (GET_OPCODE(i)) {
       case OP_RETURN: {
-        LUA_ASSERT(NULL, top >= GETARG_U(i), "wrong stack");
+        LUA_ASSERT(top >= GETARG_U(i), "wrong stack");
         top = GETARG_U(i);
         break;
       }
       case OP_CALL: {
         int nresults = GETARG_B(i);
         if (nresults == MULT_RET) nresults = 1;
-        LUA_ASSERT(NULL, top >= GETARG_A(i), "wrong stack");
+        LUA_ASSERT(top >= GETARG_A(i), "wrong stack");
         top = GETARG_A(i);
         while (nresults--)
           stack[top++] = pc-1;
         break;
       }
       case OP_TAILCALL: {
-        LUA_ASSERT(NULL, top >= GETARG_A(i), "wrong stack");
+        LUA_ASSERT(top >= GETARG_A(i), "wrong stack");
         top = GETARG_B(i);
         break;
       }
@@ -311,10 +311,10 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int stackpos) {
       }
       default: {
         int n;
-        LUA_ASSERT(NULL, luaK_opproperties[GET_OPCODE(i)].push != VD,
+        LUA_ASSERT(luaK_opproperties[GET_OPCODE(i)].push != VD,
                    "invalid opcode for default");
         top -= luaK_opproperties[GET_OPCODE(i)].pop;
-        LUA_ASSERT(NULL, top >= 0, "wrong stack");
+        LUA_ASSERT(top >= 0, "wrong stack");
         for (n=0; n<luaK_opproperties[GET_OPCODE(i)].push; n++)
           stack[top++] = pc-1;
       }

+ 2 - 2
lgc.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lgc.c,v 1.57 2000/06/12 13:52:05 roberto Exp roberto $
+** $Id: lgc.c,v 1.58 2000/06/26 19:28:31 roberto Exp roberto $
 ** Garbage Collector
 ** See Copyright Notice in lua.h
 */
@@ -206,7 +206,7 @@ static void collectudatatab (lua_State *L, int all) {
     TString **p = &L->udt.hash[i];
     TString *next;
     while ((next = *p) != NULL) {
-      LUA_ASSERT(L, next->marked <= 1, "udata cannot be fixed");
+      LUA_ASSERT(next->marked <= 1, "udata cannot be fixed");
       if (next->marked > all) {  /* preserve? */
         next->marked = 0;
         p = &next->nexthash;

+ 2 - 2
lobject.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lobject.c,v 1.41 2000/06/12 13:52:05 roberto Exp roberto $
+** $Id: lobject.c,v 1.42 2000/06/26 19:28:31 roberto Exp roberto $
 ** Some generic functions over Lua objects
 ** See Copyright Notice in lua.h
 */
@@ -45,7 +45,7 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) {
     case TAG_CCLOSURE: case TAG_LCLOSURE:
       return clvalue(t1) == clvalue(t2);
     default:
-      LUA_ASSERT(L, ttype(t1) == TAG_NIL, "invalid type");
+      LUA_ASSERT(ttype(t1) == TAG_NIL, "invalid type");
       return 1; /* TAG_NIL */
   }
 }

+ 5 - 5
lobject.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lobject.h,v 1.68 2000/06/26 19:28:31 roberto Exp roberto $
+** $Id: lobject.h,v 1.69 2000/06/28 20:20:36 roberto Exp roberto $
 ** Type definitions for Lua objects
 ** See Copyright Notice in lua.h
 */
@@ -15,11 +15,11 @@
 #ifdef DEBUG
 #undef NDEBUG
 #include <assert.h>
-#define LUA_INTERNALERROR(L,s)	assert(((void)s,0))
-#define LUA_ASSERT(L,c,s)	assert(((void)s,(c)))
+#define LUA_INTERNALERROR(s)	assert(((void)s,0))
+#define LUA_ASSERT(c,s)		assert(((void)s,(c)))
 #else
-#define LUA_INTERNALERROR(L,s)	/* empty */
-#define LUA_ASSERT(L,c,s)	/* empty */
+#define LUA_INTERNALERROR(s)	/* empty */
+#define LUA_ASSERT(c,s)		/* empty */
 #endif
 
 

+ 7 - 7
lparser.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lparser.c,v 1.100 2000/06/28 17:06:07 roberto Exp roberto $
+** $Id: lparser.c,v 1.101 2000/06/28 20:20:36 roberto Exp roberto $
 ** LL(1) Parser and code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -67,7 +67,7 @@ static void next (LexState *ls) {
 
 
 static void lookahead (LexState *ls) {
-  LUA_ASSERT(ls->L, ls->lookahead.token == TK_EOS, "two look-aheads");
+  LUA_ASSERT(ls->lookahead.token == TK_EOS, "two look-aheads");
   ls->lookahead.token = luaX_lex(ls);
 }
 
@@ -295,7 +295,7 @@ static void enterbreak (FuncState *fs, Breaklabel *bl) {
 
 static void leavebreak (FuncState *fs, Breaklabel *bl) {
   fs->bl = bl->previous;
-  LUA_ASSERT(fs->L, bl->stacklevel == fs->stacklevel, "wrong levels");
+  LUA_ASSERT(bl->stacklevel == fs->stacklevel, "wrong levels");
   luaK_patchlist(fs, bl->breaklist, luaK_getlabel(fs));
 }
 
@@ -349,7 +349,7 @@ static void close_func (LexState *ls) {
   luaI_registerlocalvar(ls, NULL, -1);  /* flag end of vector */
   luaM_reallocvector(L, f->locvars, fs->nvars, LocVar);
   ls->fs = fs->prev;
-  LUA_ASSERT(L, fs->bl == NULL, "wrong list end");
+  LUA_ASSERT(fs->bl == NULL, "wrong list end");
 }
 
 
@@ -363,8 +363,8 @@ Proto *luaY_parser (lua_State *L, ZIO *z) {
   chunk(&lexstate);
   check_condition(&lexstate, (lexstate.t.token == TK_EOS), "<eof> expected");
   close_func(&lexstate);
-  LUA_ASSERT(L, funcstate.prev == NULL, "wrong list end");
-  LUA_ASSERT(L, funcstate.nupvalues == 0, "no upvalues in main");
+  LUA_ASSERT(funcstate.prev == NULL, "wrong list end");
+  LUA_ASSERT(funcstate.nupvalues == 0, "no upvalues in main");
   return funcstate.f;
 }
 
@@ -1109,7 +1109,7 @@ static void chunk (LexState *ls) {
   while (!islast && !block_follow(ls->t.token)) {
     islast = stat(ls);
     optional(ls, ';');
-    LUA_ASSERT(ls->L, ls->fs->stacklevel == ls->fs->nlocalvar,
+    LUA_ASSERT(ls->fs->stacklevel == ls->fs->nlocalvar,
                "stack size != # local vars");
   }
 }

+ 3 - 3
lref.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lref.c,v 1.13 2000/06/08 17:48:31 roberto Exp roberto $
+** $Id: lref.c,v 1.14 2000/06/12 13:52:05 roberto Exp roberto $
 ** reference mechanism
 ** See Copyright Notice in lua.h
 */
@@ -106,12 +106,12 @@ void luaR_invalidaterefs (lua_State *L) {
     struct Ref *r = &L->refArray[i];
     if (r->st == HOLD && !ismarked(&r->o))
       r->st = COLLECTED;
-    LUA_ASSERT(L, (r->st == LOCK && ismarked(&r->o)) ||
+    LUA_ASSERT((r->st == LOCK && ismarked(&r->o)) ||
                 r->st == COLLECTED ||
                 r->st == NONEXT ||
                (r->st < n && VALIDLINK(L, L->refArray[r->st].st, n)),
                "inconsistent ref table");
   }
-  LUA_ASSERT(L, VALIDLINK(L, L->refFree, n), "inconsistent ref table");
+  LUA_ASSERT(VALIDLINK(L, L->refFree, n), "inconsistent ref table");
 }
 

+ 9 - 9
lstate.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstate.c,v 1.26 2000/05/08 19:32:53 roberto Exp roberto $
+** $Id: lstate.c,v 1.27 2000/06/12 13:52:05 roberto Exp roberto $
 ** Global State
 ** See Copyright Notice in lua.h
 */
@@ -88,22 +88,22 @@ lua_State *lua_newstate (const char *s, ...) {
 
 void lua_close (lua_State *L) {
   luaC_collect(L, 1);  /* collect all elements */
-  LUA_ASSERT(L, L->rootproto == NULL, "list should be empty");
-  LUA_ASSERT(L, L->rootcl == NULL, "list should be empty");
-  LUA_ASSERT(L, L->roottable == NULL, "list should be empty");
+  LUA_ASSERT(L->rootproto == NULL, "list should be empty");
+  LUA_ASSERT(L->rootcl == NULL, "list should be empty");
+  LUA_ASSERT(L->roottable == NULL, "list should be empty");
   luaS_freeall(L);
   luaM_free(L, L->stack);
   luaM_free(L, L->IMtable);
   luaM_free(L, L->refArray);
   luaM_free(L, L->Mbuffer);
   luaM_free(L, L->Cblocks);
-  LUA_ASSERT(L, L->numCblocks == 0, "Cblocks still open");
-  LUA_ASSERT(L, L->nblocks == 0, "wrong count for nblocks");
-  LUA_ASSERT(L, L->Cstack.base == L->top, "C2Lua not empty");
+  LUA_ASSERT(L->numCblocks == 0, "Cblocks still open");
+  LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks");
+  LUA_ASSERT(L->Cstack.base == L->top, "C2Lua not empty");
   luaM_free(L, L);
   if (L == lua_state) {
-    LUA_ASSERT(L, memdebug_numblocks == 0, "memory leak!");
-    LUA_ASSERT(L, memdebug_total == 0,"memory leak!");
+    LUA_ASSERT(memdebug_numblocks == 0, "memory leak!");
+    LUA_ASSERT(memdebug_total == 0,"memory leak!");
     lua_state = NULL;
   }
 }

+ 4 - 4
lstring.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstring.c,v 1.38 2000/06/12 13:52:05 roberto Exp roberto $
+** $Id: lstring.c,v 1.39 2000/06/15 17:01:12 roberto Exp roberto $
 ** String table (keeps all strings handled by Lua)
 ** See Copyright Notice in lua.h
 */
@@ -28,9 +28,9 @@ void luaS_init (lua_State *L) {
 
 
 void luaS_freeall (lua_State *L) {
-  LUA_ASSERT(L, L->strt.nuse==0, "non-empty string table");
+  LUA_ASSERT(L->strt.nuse==0, "non-empty string table");
   luaM_free(L, L->strt.hash);
-  LUA_ASSERT(L, L->udt.nuse==0, "non-empty udata table");
+  LUA_ASSERT(L->udt.nuse==0, "non-empty udata table");
   luaM_free(L, L->udt.hash);
 }
 
@@ -55,7 +55,7 @@ void luaS_resize (lua_State *L, stringtable *tb, int newsize) {
       TString *next = p->nexthash;  /* save next */
       unsigned long h = (tb == &L->strt) ? p->u.s.hash : IntPoint(p->u.d.value);
       int h1 = h&(newsize-1);  /* new position */
-      LUA_ASSERT(L, h%newsize == (h&(newsize-1)),
+      LUA_ASSERT(h%newsize == (h&(newsize-1)),
                     "a&(x-1) == a%x, for x power of 2");
       p->nexthash = newhash[h1];  /* chain it in new position */
       newhash[h1] = p;

+ 4 - 4
ltable.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltable.c,v 1.48 2000/06/12 13:52:05 roberto Exp roberto $
+** $Id: ltable.c,v 1.49 2000/06/28 17:03:56 roberto Exp roberto $
 ** Lua tables (hash)
 ** See Copyright Notice in lua.h
 */
@@ -63,7 +63,7 @@ Node *luaH_mainposition (const Hash *t, const TObject *key) {
     default:
       return NULL;  /* invalid key */
   }
-  LUA_ASSERT(L, h%(unsigned int)t->size == (h&((unsigned int)t->size-1)),
+  LUA_ASSERT(h%(unsigned int)t->size == (h&((unsigned int)t->size-1)),
             "a&(x-1) == a%x, for x power of 2");
   return &t->node[h&(t->size-1)];
 }
@@ -140,7 +140,7 @@ void luaH_remove (Hash *t, TObject *key) {
     }
     ttype(key) = TAG_NUMBER;
     nvalue(key) = n;
-    LUA_ASSERT(L, luaH_mainposition(t, key) == mp, "cannot change hash");
+    LUA_ASSERT(luaH_mainposition(t, key) == mp, "cannot change hash");
   }
 }
 
@@ -196,7 +196,7 @@ static void rehash (lua_State *L, Hash *t) {
   Node *nold = t->node;
   int nelems = numuse(t);
   int i;
-  LUA_ASSERT(L, nelems<=oldsize, "wrong count");
+  LUA_ASSERT(nelems<=oldsize, "wrong count");
   if (nelems >= oldsize-oldsize/4)  /* using more than 3/4? */
     setnodevector(L, t, (lint32)oldsize*2);
   else if (nelems <= oldsize/4 &&  /* less than 1/4? */

+ 7 - 7
lvm.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lvm.c,v 1.118 2000/06/27 19:00:36 roberto Exp roberto $
+** $Id: lvm.c,v 1.119 2000/06/28 20:20:36 roberto Exp roberto $
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -384,7 +384,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
 
       case OP_PUSHNIL: {
         int n = GETARG_U(i);
-        LUA_ASSERT(L, n>0, "invalid argument");
+        LUA_ASSERT(n>0, "invalid argument");
         do {
           ttype(top++) = TAG_NIL;
         } while (--n > 0);
@@ -648,8 +648,8 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
         break;
 
       case OP_FORLOOP: {
-        LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid step");
-        LUA_ASSERT(L, ttype(top-2) == TAG_NUMBER, "invalid limit");
+        LUA_ASSERT(ttype(top-1) == TAG_NUMBER, "invalid step");
+        LUA_ASSERT(ttype(top-2) == TAG_NUMBER, "invalid limit");
         if (ttype(top-3) != TAG_NUMBER)
           lua_error(L, "`for' index must be a number");
         nvalue(top-3) += nvalue(top-1);  /* increment index */
@@ -675,7 +675,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
         }
         else {
           top += 2;  /* index,value */
-          LUA_ASSERT(L, top==L->top, "bad top");
+          LUA_ASSERT(top==L->top, "bad top");
         }
         break;
       }
@@ -683,8 +683,8 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
       case OP_LFORLOOP: {
         int n;
         top -= 2;  /* remove old index,value */
-        LUA_ASSERT(L, ttype(top-2) == TAG_TABLE, "invalid table");
-        LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid counter");
+        LUA_ASSERT(ttype(top-2) == TAG_TABLE, "invalid table");
+        LUA_ASSERT(ttype(top-1) == TAG_NUMBER, "invalid counter");
         L->top = top;
         n = luaA_next(L, hvalue(top-2), (int)nvalue(top-1));
         if (n == 0)  /* end loop? */