short string in matrix should be in fixed set

This commit is contained in:
Cloud Wu
2019-06-13 17:55:45 +08:00
parent 7fed938593
commit b45384cc9f
2 changed files with 4 additions and 2 deletions

View File

@@ -935,7 +935,6 @@ new_string(unsigned int h, const char *str, lu_byte l) {
memset(ts, 0, sz);
setbits(ts->marked, WHITEBITS);
gray2black(ts);
makeshared(ts);
ts->tt = LUA_TSHRSTR;
ts->hash = h;
ts->shrlen = l;

View File

@@ -47,7 +47,10 @@ mark_shared(lua_State *L) {
case LUA_TSTRING: {
const char *str = lua_tostring(L, idx);
TString *ts = (TString *)(str - sizeof(UTString));
makeshared(ts);
if(ts->tt == LUA_TLNGSTR)
makeshared(ts);
else
luaS_fix(G(L), ts);
break;
}
default: