External strings
Strings can use external buffers to store their contents.
This commit is contained in:
4
lgc.c
4
lgc.c
@@ -813,7 +813,9 @@ static void freeobj (lua_State *L, GCObject *o) {
|
||||
}
|
||||
case LUA_VLNGSTR: {
|
||||
TString *ts = gco2ts(o);
|
||||
luaM_freemem(L, ts, sizestrlng(ts->u.lnglen));
|
||||
if (ts->shrlen == LSTRMEM) /* must free external string? */
|
||||
(*ts->falloc)(ts->ud, ts->contents, ts->u.lnglen + 1, 0);
|
||||
luaM_freemem(L, ts, luaS_sizelngstr(ts->u.lnglen, ts->shrlen));
|
||||
break;
|
||||
}
|
||||
default: lua_assert(0);
|
||||
|
||||
Reference in New Issue
Block a user