From c5fee7615e979e3a39af44614f82938519dedb68 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 11 Oct 1999 14:13:42 -0200 Subject: new implementation for string hashing, with chaining. --- lobject.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'lobject.h') diff --git a/lobject.h b/lobject.h index 99239909..d69f7c5a 100644 --- a/lobject.h +++ b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 1.30 1999/09/06 20:34:18 roberto Exp roberto $ +** $Id: lobject.h,v 1.31 1999/10/04 17:51:04 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -14,13 +14,15 @@ #ifdef DEBUG -#include "lauxlib.h" -#define LUA_INTERNALERROR(s) \ - luaL_verror("INTERNAL ERROR - %s [%s:%d]",(s),__FILE__,__LINE__) -#define LUA_ASSERT(c,s) { if (!(c)) LUA_INTERNALERROR(s); } +#ifdef NDEBUG +#undef NDEBUG +#endif +#include +#define LUA_INTERNALERROR(s) assert(0) +#define LUA_ASSERT(c,s) assert(c) #else -#define LUA_INTERNALERROR(s) /* empty */ -#define LUA_ASSERT(c,s) /* empty */ +#define LUA_INTERNALERROR(s) /* empty */ +#define LUA_ASSERT(c,s) /* empty */ #endif @@ -90,8 +92,8 @@ typedef struct TObject { */ typedef struct TaggedString { - struct TaggedString *next; - int marked; + struct TaggedString *nexthash; /* chain hash table */ + struct TaggedString *nextglobal; /* chain global variables */ unsigned long hash; int constindex; /* hint to reuse constants (= -1 if this is a userdata) */ union { @@ -104,6 +106,7 @@ typedef struct TaggedString { void *v; /* if this is a userdata, here is its value */ } d; } u; + unsigned char marked; char str[1]; /* \0 byte already reserved */ } TaggedString; -- cgit v1.2.3-55-g6feb