diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-05-03 13:01:57 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-05-03 13:01:57 -0300 |
commit | ad2531a0eefb6950d589c0d508b1f959f3f58d8b (patch) | |
tree | 706eca04d13655367b3743bd6a4e8c544a2b0928 /lstring.c | |
parent | bc1c718cc02d4a0163110cb21bcbdd2985e4d28d (diff) | |
download | lua-ad2531a0eefb6950d589c0d508b1f959f3f58d8b.tar.gz lua-ad2531a0eefb6950d589c0d508b1f959f3f58d8b.tar.bz2 lua-ad2531a0eefb6950d589c0d508b1f959f3f58d8b.zip |
more complete (and hopefuly more correct) handling of 'sizeof(char)'
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 2.17 2010/04/03 20:24:18 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.18 2010/05/10 18:23:45 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 | */ |
@@ -84,8 +84,9 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | |||
84 | o != NULL; | 84 | o != NULL; |
85 | o = gch(o)->next) { | 85 | o = gch(o)->next) { |
86 | TString *ts = rawgco2ts(o); | 86 | TString *ts = rawgco2ts(o); |
87 | if (h == ts->tsv.hash && ts->tsv.len == l && | 87 | if (h == ts->tsv.hash && |
88 | (memcmp(str, getstr(ts), l) == 0)) { | 88 | ts->tsv.len == l && |
89 | (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) { | ||
89 | if (isdead(G(L), o)) /* string is dead (but was not collected yet)? */ | 90 | if (isdead(G(L), o)) /* string is dead (but was not collected yet)? */ |
90 | changewhite(o); /* resurrect it */ | 91 | changewhite(o); /* resurrect it */ |
91 | return ts; | 92 | return ts; |