diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-22 14:15:18 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-22 14:15:18 -0300 |
| commit | 52ee91dd73199e068d31d3ac138d933ddd4fb9b1 (patch) | |
| tree | 9f9f1fdc16c8a3464fef14b9946482df688c2ea8 /lstring.c | |
| parent | 191fd35f0a6cd47ea03417a663395acf5d0e9bf5 (diff) | |
| download | lua-52ee91dd73199e068d31d3ac138d933ddd4fb9b1.tar.gz lua-52ee91dd73199e068d31d3ac138d933ddd4fb9b1.tar.bz2 lua-52ee91dd73199e068d31d3ac138d933ddd4fb9b1.zip | |
better encapsulation of some types
Diffstat (limited to '')
| -rw-r--r-- | lstring.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 1.58 2001/02/09 20:29:33 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.59 2001/02/20 18:15:33 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 | */ |
| @@ -69,7 +69,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | |||
| 69 | size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ | 69 | size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ |
| 70 | size_t l1; | 70 | size_t l1; |
| 71 | for (l1=l; l1>=step; l1-=step) /* compute hash */ | 71 | for (l1=l; l1>=step; l1-=step) /* compute hash */ |
| 72 | h = h ^ ((h<<5)+(h>>2)+(unsigned char)str[l1-1]); | 72 | h = h ^ ((h<<5)+(h>>2)+uchar(str[l1-1])); |
| 73 | for (ts = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; ts; ts = ts->nexthash) { | 73 | for (ts = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; ts; ts = ts->nexthash) { |
| 74 | if (ts->len == l && (memcmp(str, getstr(ts), l) == 0)) | 74 | if (ts->len == l && (memcmp(str, getstr(ts), l) == 0)) |
| 75 | return ts; | 75 | return ts; |
