diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-02-01 19:57:15 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-02-01 19:57:15 -0200 |
commit | 678c1255c92eed9c2c7564d340a5563b17395158 (patch) | |
tree | ca35d119d770835b59d34cdec93805190d3155d1 /ltable.c | |
parent | a4b96ce9a3305ae3585c0bb143fa7342c140f20b (diff) | |
download | lua-678c1255c92eed9c2c7564d340a5563b17395158.tar.gz lua-678c1255c92eed9c2c7564d340a5563b17395158.tar.bz2 lua-678c1255c92eed9c2c7564d340a5563b17395158.zip |
random seed used in the hash of all strings to avoid intentional
collisions
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.67 2011/11/30 12:41:45 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.69 2012/01/25 21:05:40 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 | */ |
@@ -101,7 +101,7 @@ static Node *mainposition (const Table *t, const TValue *key) { | |||
101 | case LUA_TLNGSTR: { | 101 | case LUA_TLNGSTR: { |
102 | TString *s = rawtsvalue(key); | 102 | TString *s = rawtsvalue(key); |
103 | if (s->tsv.extra == 0) { /* no hash? */ | 103 | if (s->tsv.extra == 0) { /* no hash? */ |
104 | s->tsv.hash = luaS_hash(getstr(s), s->tsv.len); | 104 | s->tsv.hash = luaS_hash(getstr(s), s->tsv.len, s->tsv.hash); |
105 | s->tsv.extra = 1; /* now it has its hash */ | 105 | s->tsv.extra = 1; /* now it has its hash */ |
106 | } | 106 | } |
107 | return hashstr(t, rawtsvalue(key)); | 107 | return hashstr(t, rawtsvalue(key)); |