diff options
| -rw-r--r-- | lobject.h | 2 | ||||
| -rw-r--r-- | ltable.c | 18 |
2 files changed, 10 insertions, 10 deletions
| @@ -68,7 +68,7 @@ typedef struct TValue { | |||
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | #define val_(o) ((o)->value_) | 70 | #define val_(o) ((o)->value_) |
| 71 | #define valraw(o) (&val_(o)) | 71 | #define valraw(o) (val_(o)) |
| 72 | 72 | ||
| 73 | 73 | ||
| 74 | /* raw type tag of a TValue */ | 74 | /* raw type tag of a TValue */ |
| @@ -150,22 +150,22 @@ static int l_hashfloat (lua_Number n) { | |||
| 150 | ** and value in 'vkl') so that we can call it on keys inserted into | 150 | ** and value in 'vkl') so that we can call it on keys inserted into |
| 151 | ** nodes. | 151 | ** nodes. |
| 152 | */ | 152 | */ |
| 153 | static Node *mainposition (const Table *t, int ktt, const Value *kvl) { | 153 | static Node *mainposition (const Table *t, int ktt, const Value kvl) { |
| 154 | switch (withvariant(ktt)) { | 154 | switch (withvariant(ktt)) { |
| 155 | case LUA_VNUMINT: { | 155 | case LUA_VNUMINT: { |
| 156 | lua_Integer key = ivalueraw(*kvl); | 156 | lua_Integer key = ivalueraw(kvl); |
| 157 | return hashint(t, key); | 157 | return hashint(t, key); |
| 158 | } | 158 | } |
| 159 | case LUA_VNUMFLT: { | 159 | case LUA_VNUMFLT: { |
| 160 | lua_Number n = fltvalueraw(*kvl); | 160 | lua_Number n = fltvalueraw(kvl); |
| 161 | return hashmod(t, l_hashfloat(n)); | 161 | return hashmod(t, l_hashfloat(n)); |
| 162 | } | 162 | } |
| 163 | case LUA_VSHRSTR: { | 163 | case LUA_VSHRSTR: { |
| 164 | TString *ts = tsvalueraw(*kvl); | 164 | TString *ts = tsvalueraw(kvl); |
| 165 | return hashstr(t, ts); | 165 | return hashstr(t, ts); |
| 166 | } | 166 | } |
| 167 | case LUA_VLNGSTR: { | 167 | case LUA_VLNGSTR: { |
| 168 | TString *ts = tsvalueraw(*kvl); | 168 | TString *ts = tsvalueraw(kvl); |
| 169 | return hashpow2(t, luaS_hashlongstr(ts)); | 169 | return hashpow2(t, luaS_hashlongstr(ts)); |
| 170 | } | 170 | } |
| 171 | case LUA_VFALSE: | 171 | case LUA_VFALSE: |
| @@ -173,15 +173,15 @@ static Node *mainposition (const Table *t, int ktt, const Value *kvl) { | |||
| 173 | case LUA_VTRUE: | 173 | case LUA_VTRUE: |
| 174 | return hashboolean(t, 1); | 174 | return hashboolean(t, 1); |
| 175 | case LUA_VLIGHTUSERDATA: { | 175 | case LUA_VLIGHTUSERDATA: { |
| 176 | void *p = pvalueraw(*kvl); | 176 | void *p = pvalueraw(kvl); |
| 177 | return hashpointer(t, p); | 177 | return hashpointer(t, p); |
| 178 | } | 178 | } |
| 179 | case LUA_VLCF: { | 179 | case LUA_VLCF: { |
| 180 | lua_CFunction f = fvalueraw(*kvl); | 180 | lua_CFunction f = fvalueraw(kvl); |
| 181 | return hashpointer(t, f); | 181 | return hashpointer(t, f); |
| 182 | } | 182 | } |
| 183 | default: { | 183 | default: { |
| 184 | GCObject *o = gcvalueraw(*kvl); | 184 | GCObject *o = gcvalueraw(kvl); |
| 185 | return hashpointer(t, o); | 185 | return hashpointer(t, o); |
| 186 | } | 186 | } |
| 187 | } | 187 | } |
| @@ -691,7 +691,7 @@ void luaH_newkey (lua_State *L, Table *t, const TValue *key, TValue *value) { | |||
| 691 | return; | 691 | return; |
| 692 | } | 692 | } |
| 693 | lua_assert(!isdummy(t)); | 693 | lua_assert(!isdummy(t)); |
| 694 | othern = mainposition(t, keytt(mp), &keyval(mp)); | 694 | othern = mainposition(t, keytt(mp), keyval(mp)); |
| 695 | if (othern != mp) { /* is colliding node out of its main position? */ | 695 | if (othern != mp) { /* is colliding node out of its main position? */ |
| 696 | /* yes; move colliding node into free position */ | 696 | /* yes; move colliding node into free position */ |
| 697 | while (othern + gnext(othern) != mp) /* find previous */ | 697 | while (othern + gnext(othern) != mp) /* find previous */ |
