aboutsummaryrefslogtreecommitdiff
path: root/lstring.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-06-19 11:27:00 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-06-19 11:27:00 -0300
commit130c0e40e01e24a79f7e416d1cc4187cd4a2a5fc (patch)
tree946ed95a3c70012ba57e0be4abdd4a5e7263fc44 /lstring.c
parentc72fb1cf8e0869aa4adc894c4e28f9d1be2e6574 (diff)
downloadlua-130c0e40e01e24a79f7e416d1cc4187cd4a2a5fc.tar.gz
lua-130c0e40e01e24a79f7e416d1cc4187cd4a2a5fc.tar.bz2
lua-130c0e40e01e24a79f7e416d1cc4187cd4a2a5fc.zip
new constant 'MAX_SIZE', distinct from 'MAX_SIZET', for sizes visible
from Lua; these must fit in a lua_Integer
Diffstat (limited to 'lstring.c')
-rw-r--r--lstring.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lstring.c b/lstring.c
index 48fd1414..9809f006 100644
--- a/lstring.c
+++ b/lstring.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.c,v 2.25 2012/10/02 17:41:50 roberto Exp roberto $ 2** $Id: lstring.c,v 2.26 2013/01/08 13:50:10 roberto Exp roberto $
3** String table (keeps all strings handled by Lua) 3** String table (keeps all strings handled by Lua)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -157,7 +157,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
157 if (l <= LUAI_MAXSHORTLEN) /* short string? */ 157 if (l <= LUAI_MAXSHORTLEN) /* short string? */
158 return internshrstr(L, str, l); 158 return internshrstr(L, str, l);
159 else { 159 else {
160 if (l + 1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) 160 if (l + 1 > (MAX_SIZE - sizeof(TString))/sizeof(char))
161 luaM_toobig(L); 161 luaM_toobig(L);
162 return createstrobj(L, str, l, LUA_TLNGSTR, G(L)->seed, NULL); 162 return createstrobj(L, str, l, LUA_TLNGSTR, G(L)->seed, NULL);
163 } 163 }
@@ -174,7 +174,7 @@ TString *luaS_new (lua_State *L, const char *str) {
174 174
175Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { 175Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
176 Udata *u; 176 Udata *u;
177 if (s > MAX_SIZET - sizeof(Udata)) 177 if (s > MAX_SIZE - sizeof(Udata))
178 luaM_toobig(L); 178 luaM_toobig(L);
179 u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u; 179 u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u;
180 u->uv.len = s; 180 u->uv.len = s;