lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 07a9eab23ac073362f231ddc7215688cf221ff45
parent 9363a8b9901a5643c9da061ea8dda8a86cdc7ef1
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 25 Aug 2023 15:54:47 -0300

Cannot use 'getshrstr' before setting 'shrlen'

Diffstat:
Mlstring.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lstring.c b/lstring.c @@ -207,8 +207,8 @@ static TString *internshrstr (lua_State *L, const char *str, size_t l) { list = &tb->hash[lmod(h, tb->size)]; /* rehash with new size */ } ts = createstrobj(L, l, LUA_VSHRSTR, h); - memcpy(getshrstr(ts), str, l * sizeof(char)); ts->shrlen = cast_byte(l); + memcpy(getshrstr(ts), str, l * sizeof(char)); ts->u.hnext = *list; *list = ts; tb->nuse++;