aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-10-11 14:13:42 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-10-11 14:13:42 -0200
commitc5fee7615e979e3a39af44614f82938519dedb68 (patch)
tree831ad8d88aba1d15e6337838d11e0234bd2e96d6 /lobject.h
parentcca78b5c71f4def3d3d80c71f690f8380b3cb35e (diff)
downloadlua-c5fee7615e979e3a39af44614f82938519dedb68.tar.gz
lua-c5fee7615e979e3a39af44614f82938519dedb68.tar.bz2
lua-c5fee7615e979e3a39af44614f82938519dedb68.zip
new implementation for string hashing, with chaining.
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/lobject.h b/lobject.h
index 99239909..d69f7c5a 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 1.30 1999/09/06 20:34:18 roberto Exp roberto $ 2** $Id: lobject.h,v 1.31 1999/10/04 17:51:04 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*/
@@ -14,13 +14,15 @@
14 14
15 15
16#ifdef DEBUG 16#ifdef DEBUG
17#include "lauxlib.h" 17#ifdef NDEBUG
18#define LUA_INTERNALERROR(s) \ 18#undef NDEBUG
19 luaL_verror("INTERNAL ERROR - %s [%s:%d]",(s),__FILE__,__LINE__) 19#endif
20#define LUA_ASSERT(c,s) { if (!(c)) LUA_INTERNALERROR(s); } 20#include <assert.h>
21#define LUA_INTERNALERROR(s) assert(0)
22#define LUA_ASSERT(c,s) assert(c)
21#else 23#else
22#define LUA_INTERNALERROR(s) /* empty */ 24#define LUA_INTERNALERROR(s) /* empty */
23#define LUA_ASSERT(c,s) /* empty */ 25#define LUA_ASSERT(c,s) /* empty */
24#endif 26#endif
25 27
26 28
@@ -90,8 +92,8 @@ typedef struct TObject {
90*/ 92*/
91 93
92typedef struct TaggedString { 94typedef struct TaggedString {
93 struct TaggedString *next; 95 struct TaggedString *nexthash; /* chain hash table */
94 int marked; 96 struct TaggedString *nextglobal; /* chain global variables */
95 unsigned long hash; 97 unsigned long hash;
96 int constindex; /* hint to reuse constants (= -1 if this is a userdata) */ 98 int constindex; /* hint to reuse constants (= -1 if this is a userdata) */
97 union { 99 union {
@@ -104,6 +106,7 @@ typedef struct TaggedString {
104 void *v; /* if this is a userdata, here is its value */ 106 void *v; /* if this is a userdata, here is its value */
105 } d; 107 } d;
106 } u; 108 } u;
109 unsigned char marked;
107 char str[1]; /* \0 byte already reserved */ 110 char str[1]; /* \0 byte already reserved */
108} TaggedString; 111} TaggedString;
109 112