summaryrefslogtreecommitdiff
path: root/lstring.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-10-08 12:53:31 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-10-08 12:53:31 -0300
commitdf45f7118bb1c849bca789cbeaaa5a2268b2c601 (patch)
treee8300189770bcc29ca82ddfd78c145c8d76656b6 /lstring.c
parent880df57e525979c1372c2ef426319c0b01b9c9a4 (diff)
downloadlua-github-df45f7118bb1c849bca789cbeaaa5a2268b2c601.tar.gz
detail (added assertion)
Diffstat (limited to 'lstring.c')
-rw-r--r--lstring.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lstring.c b/lstring.c
index b1b084d2..ccdee6b9 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstring.c,v 2.52 2015/09/17 15:51:05 roberto Exp roberto $
+** $Id: lstring.c,v 2.53 2015/09/22 14:18:24 roberto Exp roberto $
** String table (keeps all strings handled by Lua)
** See Copyright Notice in lua.h
*/
@@ -160,6 +160,7 @@ static TString *internshrstr (lua_State *L, const char *str, size_t l) {
global_State *g = G(L);
unsigned int h = luaS_hash(str, l, g->seed);
TString **list = &g->strt.hash[lmod(h, g->strt.size)];
+ lua_assert(str != NULL); /* otherwise 'memcmp'/'memcpy' are undefined */
for (ts = *list; ts != NULL; ts = ts->u.hnext) {
if (l == ts->shrlen &&
(memcmp(str, getstr(ts), l * sizeof(char)) == 0)) {