aboutsummaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-03-31 11:02:58 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-03-31 11:02:58 -0300
commitad5574c4c97af3ef863a6fb4b72142f3780103b2 (patch)
tree7ef70322749e3e433321edbea89d61087d820c55 /hash.c
parent264f8c5e7bd168de2f0ca07399e6fc70d5a820d3 (diff)
downloadlua-ad5574c4c97af3ef863a6fb4b72142f3780103b2.tar.gz
lua-ad5574c4c97af3ef863a6fb4b72142f3780103b2.tar.bz2
lua-ad5574c4c97af3ef863a6fb4b72142f3780103b2.zip
"Object" renamed to "TObject" (Tagged Object), to avoid conflicts with
pre-defined names in some C compilers.
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hash.c b/hash.c
index 8759938c..9e0170c4 100644
--- a/hash.c
+++ b/hash.c
@@ -3,7 +3,7 @@
3** hash manager for lua 3** hash manager for lua
4*/ 4*/
5 5
6char *rcs_hash="$Id: hash.c,v 2.36 1997/03/19 19:41:10 roberto Exp roberto $"; 6char *rcs_hash="$Id: hash.c,v 2.37 1997/03/21 18:52:37 roberto Exp roberto $";
7 7
8 8
9#include "mem.h" 9#include "mem.h"
@@ -48,7 +48,7 @@ int luaI_redimension (int nhash)
48 return 0; /* to avoid warnings */ 48 return 0; /* to avoid warnings */
49} 49}
50 50
51static int hashindex (Hash *t, Object *ref) /* hash function */ 51static int hashindex (Hash *t, TObject *ref) /* hash function */
52{ 52{
53 long int h; 53 long int h;
54 switch (ttype(ref)) { 54 switch (ttype(ref)) {
@@ -70,7 +70,7 @@ static int hashindex (Hash *t, Object *ref) /* hash function */
70 return h%nhash(t); /* make it a valid index */ 70 return h%nhash(t); /* make it a valid index */
71} 71}
72 72
73int lua_equalObj (Object *t1, Object *t2) 73int lua_equalObj (TObject *t1, TObject *t2)
74{ 74{
75 if (ttype(t1) != ttype(t2)) return 0; 75 if (ttype(t1) != ttype(t2)) return 0;
76 switch (ttype(t1)) 76 switch (ttype(t1))
@@ -87,7 +87,7 @@ int lua_equalObj (Object *t1, Object *t2)
87 } 87 }
88} 88}
89 89
90static int present (Hash *t, Object *ref) 90static int present (Hash *t, TObject *ref)
91{ 91{
92 int h = hashindex(t, ref); 92 int h = hashindex(t, ref);
93 while (ttype(ref(node(t, h))) != LUA_T_NIL) 93 while (ttype(ref(node(t, h))) != LUA_T_NIL)
@@ -162,7 +162,7 @@ void lua_hashmark (Hash *h)
162void luaI_hashcallIM (void) 162void luaI_hashcallIM (void)
163{ 163{
164 Hash *curr_array; 164 Hash *curr_array;
165 Object t; 165 TObject t;
166 ttype(&t) = LUA_T_ARRAY; 166 ttype(&t) = LUA_T_ARRAY;
167 for (curr_array = listhead; curr_array; curr_array = curr_array->next) 167 for (curr_array = listhead; curr_array; curr_array = curr_array->next)
168 if (markarray(curr_array) != 1) 168 if (markarray(curr_array) != 1)
@@ -242,7 +242,7 @@ static void rehash (Hash *t)
242** If the hash node is present, return its pointer, otherwise return 242** If the hash node is present, return its pointer, otherwise return
243** null. 243** null.
244*/ 244*/
245Object *lua_hashget (Hash *t, Object *ref) 245TObject *lua_hashget (Hash *t, TObject *ref)
246{ 246{
247 int h = present(t, ref); 247 int h = present(t, ref);
248 if (ttype(ref(node(t, h))) != LUA_T_NIL) return val(node(t, h)); 248 if (ttype(ref(node(t, h))) != LUA_T_NIL) return val(node(t, h));
@@ -254,7 +254,7 @@ Object *lua_hashget (Hash *t, Object *ref)
254** If the hash node is present, return its pointer, otherwise create a new 254** If the hash node is present, return its pointer, otherwise create a new
255** node for the given reference and also return its pointer. 255** node for the given reference and also return its pointer.
256*/ 256*/
257Object *lua_hashdefine (Hash *t, Object *ref) 257TObject *lua_hashdefine (Hash *t, TObject *ref)
258{ 258{
259 int h; 259 int h;
260 Node *n; 260 Node *n;