lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 36e1390631a4b89f0a8a3111978780de0d53466c
parent 8f0f54ec3835f5d1637ae2720e2b4de6a177574a
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 31 Mar 2000 13:28:23 -0300

details.

Diffstat:
Mllimits.h | 13++++++++++++-
Mlobject.c | 8+++-----
Mlobject.h | 12++++++------
Mlstate.c | 7+------
Mltable.c | 4++--
5 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/llimits.h b/llimits.h @@ -1,5 +1,5 @@ /* -** $Id: llimits.h,v 1.2 2000/03/24 19:49:23 roberto Exp roberto $ +** $Id: llimits.h,v 1.3 2000/03/27 20:08:33 roberto Exp roberto $ ** Limits, basic types, and some other "instalation-dependent" definitions ** See Copyright Notice in lua.h */ @@ -43,6 +43,13 @@ typedef LUA_NUM_TYPE Number; #define MINPOWER2 4 /* minimum size for "growing" vectors */ + +#ifndef DEFAULT_STACK_SIZE +#define DEFAULT_STACK_SIZE 1024 +#endif + + + /* ** type for virtual-machine instructions ** must be an unsigned with 4 bytes (see details in lopcodes.h) @@ -151,7 +158,11 @@ typedef unsigned long Instruction; /* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 64 +#if LFIELDS_PER_FLUSH>(MAXSTACK/4) +#undef LFIELDS_PER_FLUSH #define LFIELDS_PER_FLUSH (MAXSTACK/4) +#endif /* number of record items to accumulate before a SETMAP instruction */ /* (each item counts 2 elements on the stack: an index and a value) */ diff --git a/lobject.c b/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 1.34 2000/03/27 20:10:21 roberto Exp roberto $ +** $Id: lobject.c,v 1.35 2000/03/29 20:19:20 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -42,11 +42,9 @@ int luaO_equalval (const TObject *t1, const TObject *t2) { return avalue(t1) == avalue(t2); case TAG_CCLOSURE: case TAG_LCLOSURE: return clvalue(t1) == clvalue(t2); - case TAG_NIL: - return 1; default: - LUA_INTERNALERROR(L, "invalid type"); - return 0; /* UNREACHABLE */ + LUA_ASSERT(L, ttype(t1) == TAG_NIL, "invalid type"); + return 1; /* TAG_NIL */ } } diff --git a/lobject.h b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 1.57 2000/03/29 20:19:20 roberto Exp roberto $ +** $Id: lobject.h,v 1.58 2000/03/30 20:55:50 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -15,8 +15,8 @@ #ifdef DEBUG #undef NDEBUG #include <assert.h> -#define LUA_INTERNALERROR(L,s) assert(0) -#define LUA_ASSERT(L,c,s) assert(c) +#define LUA_INTERNALERROR(L,s) assert(((void)s,0)) +#define LUA_ASSERT(L,c,s) assert(((void)s,(c))) #else #define LUA_INTERNALERROR(L,s) /* empty */ #define LUA_ASSERT(L,c,s) /* empty */ @@ -24,10 +24,10 @@ #ifdef DEBUG -/* to avoid warnings and make sure is is really unused */ -#define UNUSED(x) (x=0, (void)x) +/* to avoid warnings, and make sure value is really unused */ +#define UNUSED(x) (x=0, (void)(x)) #else -#define UNUSED(x) (void)x /* to avoid warnings */ +#define UNUSED(x) ((void)(x)) /* to avoid warnings */ #endif diff --git a/lstate.c b/lstate.c @@ -1,5 +1,5 @@ /* -** $Id: lstate.c,v 1.23 1999/12/21 18:04:41 roberto Exp roberto $ +** $Id: lstate.c,v 1.24 2000/01/13 16:30:47 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -21,11 +21,6 @@ #include "ltm.h" -#ifndef DEFAULT_STACK_SIZE -#define DEFAULT_STACK_SIZE 1024 -#endif - - lua_State *lua_state = NULL; diff --git a/ltable.c b/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 1.37 2000/03/27 20:10:21 roberto Exp roberto $ +** $Id: ltable.c,v 1.38 2000/03/29 20:19:20 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -198,7 +198,7 @@ void luaH_set (lua_State *L, Hash *t, const TObject *key, const TObject *val) { mp->key = *key; mp->val = *val; for (;;) { /* check free places */ - if (ttype(&(t->firstfree)->key) == TAG_NIL) + if (ttype(&t->firstfree->key) == TAG_NIL) return; /* OK; table still has a free place */ else if (t->firstfree == t->node) break; /* cannot decrement from here */ else (t->firstfree)--;