aboutsummaryrefslogtreecommitdiff
path: root/lstring.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-11-03 13:36:01 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-11-03 13:36:01 -0200
commitd356183402e214f4859cd6508964d4b5e781c598 (patch)
tree52e58bfccd3ed8001deadc3518bbcc7d2b7ba1b8 /lstring.c
parente61ee8a036e83667de9c4378e70a278876c81135 (diff)
downloadlua-d356183402e214f4859cd6508964d4b5e781c598.tar.gz
lua-d356183402e214f4859cd6508964d4b5e781c598.tar.bz2
lua-d356183402e214f4859cd6508964d4b5e781c598.zip
new function 'luaS_hashlongstr'
Diffstat (limited to 'lstring.c')
-rw-r--r--lstring.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lstring.c b/lstring.c
index ccdee6b9..6760b97d 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.c,v 2.53 2015/09/22 14:18:24 roberto Exp roberto $ 2** $Id: lstring.c,v 2.54 2015/10/08 15:53:31 roberto Exp roberto $
3** String table (keeps all strings handled by Lua) 3** String table (keeps all strings handled by Lua)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -56,6 +56,16 @@ unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
56} 56}
57 57
58 58
59unsigned int luaS_hashlongstr (TString *ts) {
60 lua_assert(ts->tt == LUA_TLNGSTR);
61 if (ts->extra == 0) { /* no hash? */
62 ts->hash = luaS_hash(getstr(ts), ts->u.lnglen, ts->hash);
63 ts->extra = 1; /* now it has its hash */
64 }
65 return ts->hash;
66}
67
68
59/* 69/*
60** resizes the string table 70** resizes the string table
61*/ 71*/