aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-06-30 11:35:17 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-06-30 11:35:17 -0300
commitcfba57207660fd27ddac9ea51cdeb263c2d6b418 (patch)
tree3112ff095cd058017823a64dd592649ff750de89
parentaa01d2568dcecf5a12ce2d8f04e969658ea46c89 (diff)
downloadlua-cfba57207660fd27ddac9ea51cdeb263c2d6b418.tar.gz
lua-cfba57207660fd27ddac9ea51cdeb263c2d6b418.tar.bz2
lua-cfba57207660fd27ddac9ea51cdeb263c2d6b418.zip
remove dummy argument in LUA_ASSERT
-rw-r--r--lbuiltin.c4
-rw-r--r--lcode.c16
-rw-r--r--ldebug.c18
-rw-r--r--lgc.c4
-rw-r--r--lobject.c4
-rw-r--r--lobject.h10
-rw-r--r--lparser.c14
-rw-r--r--lref.c6
-rw-r--r--lstate.c18
-rw-r--r--lstring.c8
-rw-r--r--ltable.c8
-rw-r--r--lvm.c14
12 files changed, 62 insertions, 62 deletions
diff --git a/lbuiltin.c b/lbuiltin.c
index f7ba5839..19524a25 100644
--- a/lbuiltin.c
+++ b/lbuiltin.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbuiltin.c,v 1.115 2000/06/08 17:48:31 roberto Exp roberto $ 2** $Id: lbuiltin.c,v 1.116 2000/06/12 13:52:05 roberto Exp roberto $
3** Built-in functions 3** Built-in functions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -372,7 +372,7 @@ void luaB_tostring (lua_State *L) {
372 lua_pushstring(L, "nil"); 372 lua_pushstring(L, "nil");
373 return; 373 return;
374 default: 374 default:
375 LUA_INTERNALERROR(L, "invalid type"); 375 LUA_INTERNALERROR("invalid type");
376 } 376 }
377 lua_pushstring(L, buff); 377 lua_pushstring(L, buff);
378} 378}
diff --git a/lcode.c b/lcode.c
index 4163c66d..c80ea0da 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 1.39 2000/06/26 19:28:31 roberto Exp roberto $ 2** $Id: lcode.c,v 1.40 2000/06/28 20:20:36 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -191,7 +191,7 @@ void luaK_storevar (LexState *ls, const expdesc *var) {
191 luaK_code2(fs, OP_SETTABLE, 3, 3); 191 luaK_code2(fs, OP_SETTABLE, 3, 3);
192 break; 192 break;
193 default: 193 default:
194 LUA_INTERNALERROR(ls->L, "invalid var kind to store"); 194 LUA_INTERNALERROR("invalid var kind to store");
195 } 195 }
196} 196}
197 197
@@ -207,7 +207,7 @@ static OpCode invertjump (OpCode op) {
207 case OP_JMPT: case OP_JMPONT: return OP_JMPF; 207 case OP_JMPT: case OP_JMPONT: return OP_JMPF;
208 case OP_JMPF: case OP_JMPONF: return OP_JMPT; 208 case OP_JMPF: case OP_JMPONF: return OP_JMPT;
209 default: 209 default:
210 LUA_INTERNALERROR(NULL, "invalid jump instruction"); 210 LUA_INTERNALERROR("invalid jump instruction");
211 return OP_END; /* to avoid warnings */ 211 return OP_END; /* to avoid warnings */
212 } 212 }
213} 213}
@@ -282,7 +282,7 @@ static void luaK_testgo (FuncState *fs, expdesc *v, int invert, OpCode jump) {
282 discharge1(fs, v); 282 discharge1(fs, v);
283 prevpos = fs->pc-1; 283 prevpos = fs->pc-1;
284 previous = &fs->f->code[prevpos]; 284 previous = &fs->f->code[prevpos];
285 LUA_ASSERT(L, *previous==previous_instruction(fs), "no jump allowed here"); 285 LUA_ASSERT(*previous==previous_instruction(fs), "no jump allowed here");
286 if (!ISJUMP(GET_OPCODE(*previous))) 286 if (!ISJUMP(GET_OPCODE(*previous)))
287 prevpos = luaK_code1(fs, jump, NO_JUMP); 287 prevpos = luaK_code1(fs, jump, NO_JUMP);
288 else { /* last instruction is already a jump */ 288 else { /* last instruction is already a jump */
@@ -382,13 +382,13 @@ void luaK_infix (LexState *ls, int op, expdesc *v) {
382void luaK_posfix (LexState *ls, int op, expdesc *v1, expdesc *v2) { 382void luaK_posfix (LexState *ls, int op, expdesc *v1, expdesc *v2) {
383 FuncState *fs = ls->fs; 383 FuncState *fs = ls->fs;
384 if (op == TK_AND) { 384 if (op == TK_AND) {
385 LUA_ASSERT(ls->L, v1->u.l.t == NO_JUMP, "list must be closed"); 385 LUA_ASSERT(v1->u.l.t == NO_JUMP, "list must be closed");
386 discharge1(fs, v2); 386 discharge1(fs, v2);
387 v1->u.l.t = v2->u.l.t; 387 v1->u.l.t = v2->u.l.t;
388 luaK_concat(fs, &v1->u.l.f, v2->u.l.f); 388 luaK_concat(fs, &v1->u.l.f, v2->u.l.f);
389 } 389 }
390 else if (op == TK_OR) { 390 else if (op == TK_OR) {
391 LUA_ASSERT(ls->L, v1->u.l.f == NO_JUMP, "list must be closed"); 391 LUA_ASSERT(v1->u.l.f == NO_JUMP, "list must be closed");
392 discharge1(fs, v2); 392 discharge1(fs, v2);
393 v1->u.l.f = v2->u.l.f; 393 v1->u.l.f = v2->u.l.f;
394 luaK_concat(fs, &v1->u.l.t, v2->u.l.t); 394 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) {
598 case OP_GETINDEXED: 598 case OP_GETINDEXED:
599 case OP_TAILCALL: 599 case OP_TAILCALL:
600 case OP_ADDI: { 600 case OP_ADDI: {
601 LUA_INTERNALERROR(L, "instruction used only for optimizations"); 601 LUA_INTERNALERROR("instruction used only for optimizations");
602 break; 602 break;
603 } 603 }
604 default: { 604 default: {
605 LUA_ASSERT(L, delta != VD, "invalid delta"); 605 LUA_ASSERT(delta != VD, "invalid delta");
606 break; 606 break;
607 } 607 }
608 } 608 }
diff --git a/ldebug.c b/ldebug.c
index 6ab85434..00f8e94c 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 1.25 2000/06/28 20:20:36 roberto Exp roberto $ 2** $Id: ldebug.c,v 1.26 2000/06/30 14:29:35 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -101,7 +101,7 @@ static int lua_nups (StkId f) {
101 101
102static int lua_currentpc (StkId f) { 102static int lua_currentpc (StkId f) {
103 CallInfo *ci = infovalue(f); 103 CallInfo *ci = infovalue(f);
104 LUA_ASSERT(L, ttype(f) == TAG_LMARK, "function has no pc"); 104 LUA_ASSERT(ttype(f) == TAG_LMARK, "function has no pc");
105 return (*ci->pc - 1) - ci->func->f.l->code; 105 return (*ci->pc - 1) - ci->func->f.l->code;
106} 106}
107 107
@@ -165,7 +165,7 @@ static void lua_funcinfo (lua_Debug *ar, StkId func) {
165 ar->what = "C"; 165 ar->what = "C";
166 break; 166 break;
167 default: 167 default:
168 LUA_INTERNALERROR(L, "invalid `func' value"); 168 LUA_INTERNALERROR("invalid `func' value");
169 } 169 }
170 if (ar->linedefined == 0) 170 if (ar->linedefined == 0)
171 ar->what = "main"; 171 ar->what = "main";
@@ -245,24 +245,24 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int stackpos) {
245 top++; /* `arg' */ 245 top++; /* `arg' */
246 while (pc < lastpc) { 246 while (pc < lastpc) {
247 const Instruction i = code[pc++]; 247 const Instruction i = code[pc++];
248 LUA_ASSERT(NULL, top <= pt->maxstacksize, "wrong stack"); 248 LUA_ASSERT(top <= pt->maxstacksize, "wrong stack");
249 switch (GET_OPCODE(i)) { 249 switch (GET_OPCODE(i)) {
250 case OP_RETURN: { 250 case OP_RETURN: {
251 LUA_ASSERT(NULL, top >= GETARG_U(i), "wrong stack"); 251 LUA_ASSERT(top >= GETARG_U(i), "wrong stack");
252 top = GETARG_U(i); 252 top = GETARG_U(i);
253 break; 253 break;
254 } 254 }
255 case OP_CALL: { 255 case OP_CALL: {
256 int nresults = GETARG_B(i); 256 int nresults = GETARG_B(i);
257 if (nresults == MULT_RET) nresults = 1; 257 if (nresults == MULT_RET) nresults = 1;
258 LUA_ASSERT(NULL, top >= GETARG_A(i), "wrong stack"); 258 LUA_ASSERT(top >= GETARG_A(i), "wrong stack");
259 top = GETARG_A(i); 259 top = GETARG_A(i);
260 while (nresults--) 260 while (nresults--)
261 stack[top++] = pc-1; 261 stack[top++] = pc-1;
262 break; 262 break;
263 } 263 }
264 case OP_TAILCALL: { 264 case OP_TAILCALL: {
265 LUA_ASSERT(NULL, top >= GETARG_A(i), "wrong stack"); 265 LUA_ASSERT(top >= GETARG_A(i), "wrong stack");
266 top = GETARG_B(i); 266 top = GETARG_B(i);
267 break; 267 break;
268 } 268 }
@@ -311,10 +311,10 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int stackpos) {
311 } 311 }
312 default: { 312 default: {
313 int n; 313 int n;
314 LUA_ASSERT(NULL, luaK_opproperties[GET_OPCODE(i)].push != VD, 314 LUA_ASSERT(luaK_opproperties[GET_OPCODE(i)].push != VD,
315 "invalid opcode for default"); 315 "invalid opcode for default");
316 top -= luaK_opproperties[GET_OPCODE(i)].pop; 316 top -= luaK_opproperties[GET_OPCODE(i)].pop;
317 LUA_ASSERT(NULL, top >= 0, "wrong stack"); 317 LUA_ASSERT(top >= 0, "wrong stack");
318 for (n=0; n<luaK_opproperties[GET_OPCODE(i)].push; n++) 318 for (n=0; n<luaK_opproperties[GET_OPCODE(i)].push; n++)
319 stack[top++] = pc-1; 319 stack[top++] = pc-1;
320 } 320 }
diff --git a/lgc.c b/lgc.c
index 3bcfd1b7..7bdc5790 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.57 2000/06/12 13:52:05 roberto Exp roberto $ 2** $Id: lgc.c,v 1.58 2000/06/26 19:28:31 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -206,7 +206,7 @@ static void collectudatatab (lua_State *L, int all) {
206 TString **p = &L->udt.hash[i]; 206 TString **p = &L->udt.hash[i];
207 TString *next; 207 TString *next;
208 while ((next = *p) != NULL) { 208 while ((next = *p) != NULL) {
209 LUA_ASSERT(L, next->marked <= 1, "udata cannot be fixed"); 209 LUA_ASSERT(next->marked <= 1, "udata cannot be fixed");
210 if (next->marked > all) { /* preserve? */ 210 if (next->marked > all) { /* preserve? */
211 next->marked = 0; 211 next->marked = 0;
212 p = &next->nexthash; 212 p = &next->nexthash;
diff --git a/lobject.c b/lobject.c
index 7d26a981..4c2f427d 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 1.41 2000/06/12 13:52:05 roberto Exp roberto $ 2** $Id: lobject.c,v 1.42 2000/06/26 19:28:31 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -45,7 +45,7 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) {
45 case TAG_CCLOSURE: case TAG_LCLOSURE: 45 case TAG_CCLOSURE: case TAG_LCLOSURE:
46 return clvalue(t1) == clvalue(t2); 46 return clvalue(t1) == clvalue(t2);
47 default: 47 default:
48 LUA_ASSERT(L, ttype(t1) == TAG_NIL, "invalid type"); 48 LUA_ASSERT(ttype(t1) == TAG_NIL, "invalid type");
49 return 1; /* TAG_NIL */ 49 return 1; /* TAG_NIL */
50 } 50 }
51} 51}
diff --git a/lobject.h b/lobject.h
index 01235ffa..2185eac4 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.68 2000/06/26 19:28:31 roberto Exp roberto $ 2** $Id: lobject.h,v 1.69 2000/06/28 20:20:36 roberto Exp roberto $
3** Type definitions for Lua objects 3** Type definitions for Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -15,11 +15,11 @@
15#ifdef DEBUG 15#ifdef DEBUG
16#undef NDEBUG 16#undef NDEBUG
17#include <assert.h> 17#include <assert.h>
18#define LUA_INTERNALERROR(L,s) assert(((void)s,0)) 18#define LUA_INTERNALERROR(s) assert(((void)s,0))
19#define LUA_ASSERT(L,c,s) assert(((void)s,(c))) 19#define LUA_ASSERT(c,s) assert(((void)s,(c)))
20#else 20#else
21#define LUA_INTERNALERROR(L,s) /* empty */ 21#define LUA_INTERNALERROR(s) /* empty */
22#define LUA_ASSERT(L,c,s) /* empty */ 22#define LUA_ASSERT(c,s) /* empty */
23#endif 23#endif
24 24
25 25
diff --git a/lparser.c b/lparser.c
index 9ebd01be..74dd8dc1 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 1.100 2000/06/28 17:06:07 roberto Exp roberto $ 2** $Id: lparser.c,v 1.101 2000/06/28 20:20:36 roberto Exp roberto $
3** LL(1) Parser and code generator for Lua 3** LL(1) Parser and code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -67,7 +67,7 @@ static void next (LexState *ls) {
67 67
68 68
69static void lookahead (LexState *ls) { 69static void lookahead (LexState *ls) {
70 LUA_ASSERT(ls->L, ls->lookahead.token == TK_EOS, "two look-aheads"); 70 LUA_ASSERT(ls->lookahead.token == TK_EOS, "two look-aheads");
71 ls->lookahead.token = luaX_lex(ls); 71 ls->lookahead.token = luaX_lex(ls);
72} 72}
73 73
@@ -295,7 +295,7 @@ static void enterbreak (FuncState *fs, Breaklabel *bl) {
295 295
296static void leavebreak (FuncState *fs, Breaklabel *bl) { 296static void leavebreak (FuncState *fs, Breaklabel *bl) {
297 fs->bl = bl->previous; 297 fs->bl = bl->previous;
298 LUA_ASSERT(fs->L, bl->stacklevel == fs->stacklevel, "wrong levels"); 298 LUA_ASSERT(bl->stacklevel == fs->stacklevel, "wrong levels");
299 luaK_patchlist(fs, bl->breaklist, luaK_getlabel(fs)); 299 luaK_patchlist(fs, bl->breaklist, luaK_getlabel(fs));
300} 300}
301 301
@@ -349,7 +349,7 @@ static void close_func (LexState *ls) {
349 luaI_registerlocalvar(ls, NULL, -1); /* flag end of vector */ 349 luaI_registerlocalvar(ls, NULL, -1); /* flag end of vector */
350 luaM_reallocvector(L, f->locvars, fs->nvars, LocVar); 350 luaM_reallocvector(L, f->locvars, fs->nvars, LocVar);
351 ls->fs = fs->prev; 351 ls->fs = fs->prev;
352 LUA_ASSERT(L, fs->bl == NULL, "wrong list end"); 352 LUA_ASSERT(fs->bl == NULL, "wrong list end");
353} 353}
354 354
355 355
@@ -363,8 +363,8 @@ Proto *luaY_parser (lua_State *L, ZIO *z) {
363 chunk(&lexstate); 363 chunk(&lexstate);
364 check_condition(&lexstate, (lexstate.t.token == TK_EOS), "<eof> expected"); 364 check_condition(&lexstate, (lexstate.t.token == TK_EOS), "<eof> expected");
365 close_func(&lexstate); 365 close_func(&lexstate);
366 LUA_ASSERT(L, funcstate.prev == NULL, "wrong list end"); 366 LUA_ASSERT(funcstate.prev == NULL, "wrong list end");
367 LUA_ASSERT(L, funcstate.nupvalues == 0, "no upvalues in main"); 367 LUA_ASSERT(funcstate.nupvalues == 0, "no upvalues in main");
368 return funcstate.f; 368 return funcstate.f;
369} 369}
370 370
@@ -1109,7 +1109,7 @@ static void chunk (LexState *ls) {
1109 while (!islast && !block_follow(ls->t.token)) { 1109 while (!islast && !block_follow(ls->t.token)) {
1110 islast = stat(ls); 1110 islast = stat(ls);
1111 optional(ls, ';'); 1111 optional(ls, ';');
1112 LUA_ASSERT(ls->L, ls->fs->stacklevel == ls->fs->nlocalvar, 1112 LUA_ASSERT(ls->fs->stacklevel == ls->fs->nlocalvar,
1113 "stack size != # local vars"); 1113 "stack size != # local vars");
1114 } 1114 }
1115} 1115}
diff --git a/lref.c b/lref.c
index 97072843..cf355d51 100644
--- a/lref.c
+++ b/lref.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lref.c,v 1.13 2000/06/08 17:48:31 roberto Exp roberto $ 2** $Id: lref.c,v 1.14 2000/06/12 13:52:05 roberto Exp roberto $
3** reference mechanism 3** reference mechanism
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -106,12 +106,12 @@ void luaR_invalidaterefs (lua_State *L) {
106 struct Ref *r = &L->refArray[i]; 106 struct Ref *r = &L->refArray[i];
107 if (r->st == HOLD && !ismarked(&r->o)) 107 if (r->st == HOLD && !ismarked(&r->o))
108 r->st = COLLECTED; 108 r->st = COLLECTED;
109 LUA_ASSERT(L, (r->st == LOCK && ismarked(&r->o)) || 109 LUA_ASSERT((r->st == LOCK && ismarked(&r->o)) ||
110 r->st == COLLECTED || 110 r->st == COLLECTED ||
111 r->st == NONEXT || 111 r->st == NONEXT ||
112 (r->st < n && VALIDLINK(L, L->refArray[r->st].st, n)), 112 (r->st < n && VALIDLINK(L, L->refArray[r->st].st, n)),
113 "inconsistent ref table"); 113 "inconsistent ref table");
114 } 114 }
115 LUA_ASSERT(L, VALIDLINK(L, L->refFree, n), "inconsistent ref table"); 115 LUA_ASSERT(VALIDLINK(L, L->refFree, n), "inconsistent ref table");
116} 116}
117 117
diff --git a/lstate.c b/lstate.c
index 24df5d4b..b91daf5b 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.26 2000/05/08 19:32:53 roberto Exp roberto $ 2** $Id: lstate.c,v 1.27 2000/06/12 13:52:05 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -88,22 +88,22 @@ lua_State *lua_newstate (const char *s, ...) {
88 88
89void lua_close (lua_State *L) { 89void lua_close (lua_State *L) {
90 luaC_collect(L, 1); /* collect all elements */ 90 luaC_collect(L, 1); /* collect all elements */
91 LUA_ASSERT(L, L->rootproto == NULL, "list should be empty"); 91 LUA_ASSERT(L->rootproto == NULL, "list should be empty");
92 LUA_ASSERT(L, L->rootcl == NULL, "list should be empty"); 92 LUA_ASSERT(L->rootcl == NULL, "list should be empty");
93 LUA_ASSERT(L, L->roottable == NULL, "list should be empty"); 93 LUA_ASSERT(L->roottable == NULL, "list should be empty");
94 luaS_freeall(L); 94 luaS_freeall(L);
95 luaM_free(L, L->stack); 95 luaM_free(L, L->stack);
96 luaM_free(L, L->IMtable); 96 luaM_free(L, L->IMtable);
97 luaM_free(L, L->refArray); 97 luaM_free(L, L->refArray);
98 luaM_free(L, L->Mbuffer); 98 luaM_free(L, L->Mbuffer);
99 luaM_free(L, L->Cblocks); 99 luaM_free(L, L->Cblocks);
100 LUA_ASSERT(L, L->numCblocks == 0, "Cblocks still open"); 100 LUA_ASSERT(L->numCblocks == 0, "Cblocks still open");
101 LUA_ASSERT(L, L->nblocks == 0, "wrong count for nblocks"); 101 LUA_ASSERT(L->nblocks == 0, "wrong count for nblocks");
102 LUA_ASSERT(L, L->Cstack.base == L->top, "C2Lua not empty"); 102 LUA_ASSERT(L->Cstack.base == L->top, "C2Lua not empty");
103 luaM_free(L, L); 103 luaM_free(L, L);
104 if (L == lua_state) { 104 if (L == lua_state) {
105 LUA_ASSERT(L, memdebug_numblocks == 0, "memory leak!"); 105 LUA_ASSERT(memdebug_numblocks == 0, "memory leak!");
106 LUA_ASSERT(L, memdebug_total == 0,"memory leak!"); 106 LUA_ASSERT(memdebug_total == 0,"memory leak!");
107 lua_state = NULL; 107 lua_state = NULL;
108 } 108 }
109} 109}
diff --git a/lstring.c b/lstring.c
index ac526838..ffc834b8 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.c,v 1.38 2000/06/12 13:52:05 roberto Exp roberto $ 2** $Id: lstring.c,v 1.39 2000/06/15 17:01:12 roberto Exp roberto $
3** String table (keeps all strings handled by Lua) 3** String table (keeps all strings handled by Lua)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -28,9 +28,9 @@ void luaS_init (lua_State *L) {
28 28
29 29
30void luaS_freeall (lua_State *L) { 30void luaS_freeall (lua_State *L) {
31 LUA_ASSERT(L, L->strt.nuse==0, "non-empty string table"); 31 LUA_ASSERT(L->strt.nuse==0, "non-empty string table");
32 luaM_free(L, L->strt.hash); 32 luaM_free(L, L->strt.hash);
33 LUA_ASSERT(L, L->udt.nuse==0, "non-empty udata table"); 33 LUA_ASSERT(L->udt.nuse==0, "non-empty udata table");
34 luaM_free(L, L->udt.hash); 34 luaM_free(L, L->udt.hash);
35} 35}
36 36
@@ -55,7 +55,7 @@ void luaS_resize (lua_State *L, stringtable *tb, int newsize) {
55 TString *next = p->nexthash; /* save next */ 55 TString *next = p->nexthash; /* save next */
56 unsigned long h = (tb == &L->strt) ? p->u.s.hash : IntPoint(p->u.d.value); 56 unsigned long h = (tb == &L->strt) ? p->u.s.hash : IntPoint(p->u.d.value);
57 int h1 = h&(newsize-1); /* new position */ 57 int h1 = h&(newsize-1); /* new position */
58 LUA_ASSERT(L, h%newsize == (h&(newsize-1)), 58 LUA_ASSERT(h%newsize == (h&(newsize-1)),
59 "a&(x-1) == a%x, for x power of 2"); 59 "a&(x-1) == a%x, for x power of 2");
60 p->nexthash = newhash[h1]; /* chain it in new position */ 60 p->nexthash = newhash[h1]; /* chain it in new position */
61 newhash[h1] = p; 61 newhash[h1] = p;
diff --git a/ltable.c b/ltable.c
index 4b4f37ac..0e271e8c 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.48 2000/06/12 13:52:05 roberto Exp roberto $ 2** $Id: ltable.c,v 1.49 2000/06/28 17:03:56 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -63,7 +63,7 @@ Node *luaH_mainposition (const Hash *t, const TObject *key) {
63 default: 63 default:
64 return NULL; /* invalid key */ 64 return NULL; /* invalid key */
65 } 65 }
66 LUA_ASSERT(L, h%(unsigned int)t->size == (h&((unsigned int)t->size-1)), 66 LUA_ASSERT(h%(unsigned int)t->size == (h&((unsigned int)t->size-1)),
67 "a&(x-1) == a%x, for x power of 2"); 67 "a&(x-1) == a%x, for x power of 2");
68 return &t->node[h&(t->size-1)]; 68 return &t->node[h&(t->size-1)];
69} 69}
@@ -140,7 +140,7 @@ void luaH_remove (Hash *t, TObject *key) {
140 } 140 }
141 ttype(key) = TAG_NUMBER; 141 ttype(key) = TAG_NUMBER;
142 nvalue(key) = n; 142 nvalue(key) = n;
143 LUA_ASSERT(L, luaH_mainposition(t, key) == mp, "cannot change hash"); 143 LUA_ASSERT(luaH_mainposition(t, key) == mp, "cannot change hash");
144 } 144 }
145} 145}
146 146
@@ -196,7 +196,7 @@ static void rehash (lua_State *L, Hash *t) {
196 Node *nold = t->node; 196 Node *nold = t->node;
197 int nelems = numuse(t); 197 int nelems = numuse(t);
198 int i; 198 int i;
199 LUA_ASSERT(L, nelems<=oldsize, "wrong count"); 199 LUA_ASSERT(nelems<=oldsize, "wrong count");
200 if (nelems >= oldsize-oldsize/4) /* using more than 3/4? */ 200 if (nelems >= oldsize-oldsize/4) /* using more than 3/4? */
201 setnodevector(L, t, (lint32)oldsize*2); 201 setnodevector(L, t, (lint32)oldsize*2);
202 else if (nelems <= oldsize/4 && /* less than 1/4? */ 202 else if (nelems <= oldsize/4 && /* less than 1/4? */
diff --git a/lvm.c b/lvm.c
index 2fccacc6..ed29602c 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.118 2000/06/27 19:00:36 roberto Exp roberto $ 2** $Id: lvm.c,v 1.119 2000/06/28 20:20:36 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -384,7 +384,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
384 384
385 case OP_PUSHNIL: { 385 case OP_PUSHNIL: {
386 int n = GETARG_U(i); 386 int n = GETARG_U(i);
387 LUA_ASSERT(L, n>0, "invalid argument"); 387 LUA_ASSERT(n>0, "invalid argument");
388 do { 388 do {
389 ttype(top++) = TAG_NIL; 389 ttype(top++) = TAG_NIL;
390 } while (--n > 0); 390 } while (--n > 0);
@@ -648,8 +648,8 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
648 break; 648 break;
649 649
650 case OP_FORLOOP: { 650 case OP_FORLOOP: {
651 LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid step"); 651 LUA_ASSERT(ttype(top-1) == TAG_NUMBER, "invalid step");
652 LUA_ASSERT(L, ttype(top-2) == TAG_NUMBER, "invalid limit"); 652 LUA_ASSERT(ttype(top-2) == TAG_NUMBER, "invalid limit");
653 if (ttype(top-3) != TAG_NUMBER) 653 if (ttype(top-3) != TAG_NUMBER)
654 lua_error(L, "`for' index must be a number"); 654 lua_error(L, "`for' index must be a number");
655 nvalue(top-3) += nvalue(top-1); /* increment index */ 655 nvalue(top-3) += nvalue(top-1); /* increment index */
@@ -675,7 +675,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
675 } 675 }
676 else { 676 else {
677 top += 2; /* index,value */ 677 top += 2; /* index,value */
678 LUA_ASSERT(L, top==L->top, "bad top"); 678 LUA_ASSERT(top==L->top, "bad top");
679 } 679 }
680 break; 680 break;
681 } 681 }
@@ -683,8 +683,8 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
683 case OP_LFORLOOP: { 683 case OP_LFORLOOP: {
684 int n; 684 int n;
685 top -= 2; /* remove old index,value */ 685 top -= 2; /* remove old index,value */
686 LUA_ASSERT(L, ttype(top-2) == TAG_TABLE, "invalid table"); 686 LUA_ASSERT(ttype(top-2) == TAG_TABLE, "invalid table");
687 LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid counter"); 687 LUA_ASSERT(ttype(top-1) == TAG_NUMBER, "invalid counter");
688 L->top = top; 688 L->top = top;
689 n = luaA_next(L, hvalue(top-2), (int)nvalue(top-1)); 689 n = luaA_next(L, hvalue(top-2), (int)nvalue(top-1));
690 if (n == 0) /* end loop? */ 690 if (n == 0) /* end loop? */