diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-11-19 13:52:40 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-11-19 13:52:40 -0200 |
commit | 6f1ea817f5827523f8c7e429ab023e5984a84343 (patch) | |
tree | 778c20b8816afb4ee5cfc3b988ec1c31efbb7b75 /lstring.h | |
parent | cdcb236747a728e3ef0855aa16a42b73e7a9a6c6 (diff) | |
download | lua-6f1ea817f5827523f8c7e429ab023e5984a84343.tar.gz lua-6f1ea817f5827523f8c7e429ab023e5984a84343.tar.bz2 lua-6f1ea817f5827523f8c7e429ab023e5984a84343.zip |
better control over memory-size overflows
Diffstat (limited to 'lstring.h')
-rw-r--r-- | lstring.h | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.h,v 1.38 2003/11/17 19:50:05 roberto Exp roberto $ | 2 | ** $Id: lstring.h,v 1.39 2004/08/24 20:12:06 roberto Exp roberto $ |
3 | ** String table (keep all strings handled by Lua) | 3 | ** String table (keep all strings handled by Lua) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -13,10 +13,9 @@ | |||
13 | #include "lstate.h" | 13 | #include "lstate.h" |
14 | 14 | ||
15 | 15 | ||
16 | #define sizestring(l) (cast(lu_mem, sizeof(union TString))+ \ | 16 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) |
17 | (cast(lu_mem, l)+1)*sizeof(char)) | ||
18 | 17 | ||
19 | #define sizeudata(l) (cast(lu_mem, sizeof(union Udata))+(l)) | 18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) |
20 | 19 | ||
21 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) | 20 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) |
22 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ | 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ |