diff options
Diffstat (limited to 'lstring.c')
| -rw-r--r-- | lstring.c | 7 |
1 files changed, 5 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 1.83 2003/12/03 20:03:07 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.84 2003/12/04 17:22:42 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,11 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | |||
| 84 | o != NULL; | 84 | o != NULL; |
| 85 | o = o->gch.next) { | 85 | o = o->gch.next) { |
| 86 | TString *ts = gcotots(o); | 86 | TString *ts = gcotots(o); |
| 87 | if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) | 87 | if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { |
| 88 | /* string may be dead */ | ||
| 89 | if (isdead(G(L), o)) changewhite(o); | ||
| 88 | return ts; | 90 | return ts; |
| 91 | } | ||
| 89 | } | 92 | } |
| 90 | return newlstr(L, str, l, h); /* not found */ | 93 | return newlstr(L, str, l, h); /* not found */ |
| 91 | } | 94 | } |
