From b4cd38ba6c148cf7db5deae6208b660c3417cac9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 30 Apr 2004 17:13:38 -0300 Subject: new scheme for configuration through `luaconf.h' --- ltable.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'ltable.c') diff --git a/ltable.c b/ltable.c index fff4716d..0d149e9f 100644 --- a/ltable.c +++ b/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 2.1 2003/12/10 12:13:36 roberto Exp roberto $ +** $Id: ltable.c,v 2.2 2004/03/26 14:02:41 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -21,6 +21,7 @@ #include #define ltable_c +#define LUA_CORE #include "lua.h" @@ -36,19 +37,14 @@ /* ** max size of array part is 2^MAXBITS */ -#if BITS_INT > 26 +#if LUA_BITSINT > 26 #define MAXBITS 24 #else -#define MAXBITS (BITS_INT-2) +#define MAXBITS (LUA_BITSINT-2) #endif #define MAXASIZE (1 << MAXBITS) -/* function to convert a lua_Number to int (with any rounding method) */ -#ifndef lua_number2int -#define lua_number2int(i,n) ((i)=(int)(n)) -#endif - #define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) @@ -349,26 +345,6 @@ void luaH_free (lua_State *L, Table *t) { } -#if 0 -/* -** try to remove an element from a hash table; cannot move any element -** (because gc can call `remove' during a table traversal) -*/ -void luaH_remove (Table *t, Node *e) { - Node *mp = luaH_mainposition(t, gkey(e)); - if (e != mp) { /* element not in its main position? */ - while (mp->next != e) mp = mp->next; /* find previous */ - mp->next = e->next; /* remove `e' from its list */ - } - else { - if (e->next != NULL) ?? - } - lua_assert(ttisnil(gval(node))); - setnilvalue(gkey(e)); /* clear node `e' */ - e->next = NULL; -} -#endif - /* ** inserts a new key into a hash table; first, check whether key's main -- cgit v1.2.3-55-g6feb