diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-30 17:48:37 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-30 17:48:37 -0200 |
commit | 44a53df688082b9c213bdbeb28acc87c025edeb9 (patch) | |
tree | 61569119474c8a3b9015c27762ec7c3330502592 /ltable.c | |
parent | 63a822c8e199918c54e325cbc8696ed04071aba8 (diff) | |
download | lua-44a53df688082b9c213bdbeb28acc87c025edeb9.tar.gz lua-44a53df688082b9c213bdbeb28acc87c025edeb9.tar.bz2 lua-44a53df688082b9c213bdbeb28acc87c025edeb9.zip |
better to avoid dirty tricks
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 1.72 2001/01/29 17:16:58 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.73 2001/01/29 19:34:02 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 | */ |
@@ -203,7 +203,7 @@ TObject *luaH_setnum (lua_State *L, Hash *t, lua_Number key) { | |||
203 | Node *mp = hashnum(t, key); | 203 | Node *mp = hashnum(t, key); |
204 | Node *n = mp; | 204 | Node *n = mp; |
205 | do { /* check whether `key' is somewhere in the chain */ | 205 | do { /* check whether `key' is somewhere in the chain */ |
206 | if (nvalue_key(n) == key && ttype_key(n) == LUA_TNUMBER) | 206 | if (ttype_key(n) == LUA_TNUMBER && nvalue_key(n) == key) |
207 | return &n->val; /* that's all */ | 207 | return &n->val; /* that's all */ |
208 | else n = n->next; | 208 | else n = n->next; |
209 | } while (n); | 209 | } while (n); |
@@ -222,7 +222,7 @@ TObject *luaH_setstr (lua_State *L, Hash *t, TString *key) { | |||
222 | Node *mp = hashstr(t, key); | 222 | Node *mp = hashstr(t, key); |
223 | Node *n = mp; | 223 | Node *n = mp; |
224 | do { /* check whether `key' is somewhere in the chain */ | 224 | do { /* check whether `key' is somewhere in the chain */ |
225 | if (tsvalue_key(n) == key && ttype_key(n) == LUA_TSTRING) | 225 | if (ttype_key(n) == LUA_TSTRING && tsvalue_key(n) == key) |
226 | return &n->val; /* that's all */ | 226 | return &n->val; /* that's all */ |
227 | else n = n->next; | 227 | else n = n->next; |
228 | } while (n); | 228 | } while (n); |
@@ -241,7 +241,7 @@ static TObject *luaH_setany (lua_State *L, Hash *t, const TObject *key) { | |||
241 | Node *n = mp; | 241 | Node *n = mp; |
242 | do { /* check whether `key' is somewhere in the chain */ | 242 | do { /* check whether `key' is somewhere in the chain */ |
243 | /* compare as `tsvalue', but may be other pointers (it is the same) */ | 243 | /* compare as `tsvalue', but may be other pointers (it is the same) */ |
244 | if (tsvalue_key(n) == tsvalue(key) && ttype_key(n) == ttype(key)) | 244 | if (ttype_key(n) == ttype(key) && tsvalue_key(n) == tsvalue(key)) |
245 | return &n->val; /* that's all */ | 245 | return &n->val; /* that's all */ |
246 | else n = n->next; | 246 | else n = n->next; |
247 | } while (n); | 247 | } while (n); |