Skip to content

Commit 3de8f28

Browse files
authored
Merge pull request #4 from igormunkin/tarantool-1.7
Fixed empty string creation in lj_str_new
2 parents b8587fa + b92abb5 commit 3de8f28

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lj_str.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ GCstr *lj_str_new(lua_State *L, const char *str, size_t lenx)
178178
if (lenx >= LJ_MAX_STR)
179179
lj_err_msg(L, LJ_ERR_STROV);
180180
g = G(L);
181+
if (len == 0)
182+
return &g->strempty;
181183
/* Compute string hash. Constants taken from lookup3 hash by Bob Jenkins. */
182184
MSize h = lua_hash(str, len);
183-
if (h == 0)
184-
return &g->strempty;
185185
/* Check if the string has already been interned. */
186186
o = gcref(g->strhash[h & g->strmask]);
187187
#if LUAJIT_SMART_STRINGS

0 commit comments

Comments
 (0)