diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-15 17:36:57 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-15 17:36:57 -0300 |
commit | 8e586c13fcf3066886a7edd69011304eaad57a2b (patch) | |
tree | 417c2102ba8c4d693c49a2df839612d371eded50 /lstring.h | |
parent | eadf2aaaffa7a35e7f67b150ce0d57f2c17b9231 (diff) | |
download | lua-8e586c13fcf3066886a7edd69011304eaad57a2b.tar.gz lua-8e586c13fcf3066886a7edd69011304eaad57a2b.tar.bz2 lua-8e586c13fcf3066886a7edd69011304eaad57a2b.zip |
cleaner way to ensure alignment for strings and userdata
Diffstat (limited to 'lstring.h')
-rw-r--r-- | lstring.h | 16 |
1 files changed, 3 insertions, 13 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.h,v 1.31 2001/02/23 17:17:25 roberto Exp roberto $ | 2 | ** $Id: lstring.h,v 1.32 2001/06/06 18:00:19 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 | */ |
@@ -14,16 +14,6 @@ | |||
14 | 14 | ||
15 | 15 | ||
16 | /* | 16 | /* |
17 | ** type equivalent to Udata, but with maximum alignment requirements | ||
18 | */ | ||
19 | union L_UUdata { | ||
20 | Udata u; | ||
21 | union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ | ||
22 | }; | ||
23 | |||
24 | |||
25 | |||
26 | /* | ||
27 | ** any TString with mark>=FIXMARK is never collected. | 17 | ** any TString with mark>=FIXMARK is never collected. |
28 | ** Marks>=RESERVEDMARK are used to identify reserved words. | 18 | ** Marks>=RESERVEDMARK are used to identify reserved words. |
29 | */ | 19 | */ |
@@ -31,10 +21,10 @@ union L_UUdata { | |||
31 | #define RESERVEDMARK 3 | 21 | #define RESERVEDMARK 3 |
32 | 22 | ||
33 | 23 | ||
34 | #define sizestring(l) ((lu_mem)sizeof(union L_UTString)+ \ | 24 | #define sizestring(l) ((lu_mem)sizeof(union TString)+ \ |
35 | ((lu_mem)(l)+1)*sizeof(l_char)) | 25 | ((lu_mem)(l)+1)*sizeof(l_char)) |
36 | 26 | ||
37 | #define sizeudata(l) ((lu_mem)sizeof(union L_UUdata)+(l)) | 27 | #define sizeudata(l) ((lu_mem)sizeof(union Udata)+(l)) |
38 | 28 | ||
39 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) | 29 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) |
40 | #define luaS_newliteral(L, s) (luaS_newlstr(L, l_s("") s, \ | 30 | #define luaS_newliteral(L, s) (luaS_newlstr(L, l_s("") s, \ |