| 105 | |
| 106 | |
| 107 | TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { |
| 108 | GCObject *o; |
| 109 | const lua_Hash h = calchash(str, l); |
| 110 | for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; |
| 111 | o != NULL; |
| 112 | o = o->gch.next) { |
| 113 | TString *ts = rawgco2ts(o); |
| 114 | if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { |
| 115 | /* string may be dead */ |
| 116 | if (isdead(G(L), o)) changewhite(o); |
| 117 | return ts; |
| 118 | } |
| 119 | } |
| 120 | return newlstr(L, str, l, h); /* not found */ |
| 121 | } |
| 122 | |
| 123 | |
| 124 | Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { |
no test coverage detected