summaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ltable.c b/ltable.c
index 73a6011e..53d6c866 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.21 1999/02/23 14:57:28 roberto Exp roberto $ 2** $Id: ltable.c,v 1.22 1999/05/21 19:41:49 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -24,7 +24,7 @@
24 24
25 25
26 26
27static long int hashindex (TObject *ref) { 27static long int hashindex (const TObject *ref) {
28 long int h; 28 long int h;
29 switch (ttype(ref)) { 29 switch (ttype(ref)) {
30 case LUA_T_NUMBER: 30 case LUA_T_NUMBER:
@@ -53,7 +53,7 @@ static long int hashindex (TObject *ref) {
53} 53}
54 54
55 55
56Node *luaH_present (Hash *t, TObject *key) { 56Node *luaH_present (const Hash *t, const TObject *key) {
57 int tsize = nhash(t); 57 int tsize = nhash(t);
58 long int h = hashindex(key); 58 long int h = hashindex(key);
59 int h1 = h%tsize; 59 int h1 = h%tsize;
@@ -135,7 +135,7 @@ static void rehash (Hash *t) {
135} 135}
136 136
137 137
138void luaH_set (Hash *t, TObject *ref, TObject *val) { 138void luaH_set (Hash *t, const TObject *ref, const TObject *val) {
139 Node *n = luaH_present(t, ref); 139 Node *n = luaH_present(t, ref);
140 if (ttype(ref(n)) != LUA_T_NIL) 140 if (ttype(ref(n)) != LUA_T_NIL)
141 *val(n) = *val; 141 *val(n) = *val;
@@ -153,14 +153,14 @@ void luaH_set (Hash *t, TObject *ref, TObject *val) {
153} 153}
154 154
155 155
156int luaH_pos (Hash *t, TObject *r) { 156int luaH_pos (const Hash *t, const TObject *r) {
157 Node *n = luaH_present(t, r); 157 Node *n = luaH_present(t, r);
158 luaL_arg_check(ttype(val(n)) != LUA_T_NIL, 2, "key not found"); 158 luaL_arg_check(ttype(val(n)) != LUA_T_NIL, 2, "key not found");
159 return n-(t->node); 159 return n-(t->node);
160} 160}
161 161
162 162
163void luaH_setint (Hash *t, int ref, TObject *val) { 163void luaH_setint (Hash *t, int ref, const TObject *val) {
164 TObject index; 164 TObject index;
165 ttype(&index) = LUA_T_NUMBER; 165 ttype(&index) = LUA_T_NUMBER;
166 nvalue(&index) = ref; 166 nvalue(&index) = ref;
@@ -168,7 +168,7 @@ void luaH_setint (Hash *t, int ref, TObject *val) {
168} 168}
169 169
170 170
171TObject *luaH_getint (Hash *t, int ref) { 171TObject *luaH_getint (const Hash *t, int ref) {
172 TObject index; 172 TObject index;
173 ttype(&index) = LUA_T_NUMBER; 173 ttype(&index) = LUA_T_NUMBER;
174 nvalue(&index) = ref; 174 nvalue(&index) = ref;