From 130c0e40e01e24a79f7e416d1cc4187cd4a2a5fc Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 19 Jun 2013 11:27:00 -0300 Subject: new constant 'MAX_SIZE', distinct from 'MAX_SIZET', for sizes visible from Lua; these must fit in a lua_Integer --- lstring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lstring.c') diff --git a/lstring.c b/lstring.c index 48fd1414..9809f006 100644 --- a/lstring.c +++ b/lstring.c @@ -1,5 +1,5 @@ /* -** $Id: lstring.c,v 2.25 2012/10/02 17:41:50 roberto Exp roberto $ +** $Id: lstring.c,v 2.26 2013/01/08 13:50:10 roberto Exp roberto $ ** String table (keeps all strings handled by Lua) ** See Copyright Notice in lua.h */ @@ -157,7 +157,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { if (l <= LUAI_MAXSHORTLEN) /* short string? */ return internshrstr(L, str, l); else { - if (l + 1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) + if (l + 1 > (MAX_SIZE - sizeof(TString))/sizeof(char)) luaM_toobig(L); return createstrobj(L, str, l, LUA_TLNGSTR, G(L)->seed, NULL); } @@ -174,7 +174,7 @@ TString *luaS_new (lua_State *L, const char *str) { Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { Udata *u; - if (s > MAX_SIZET - sizeof(Udata)) + if (s > MAX_SIZE - sizeof(Udata)) luaM_toobig(L); u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u; u->uv.len = s; -- cgit v1.2.3-55-g6feb