mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
cleaner way to ensure alignment for strings and userdata
This commit is contained in:
parent
eadf2aaaff
commit
8e586c13fc
12 changed files with 92 additions and 103 deletions
16
lstring.h
16
lstring.h
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lstring.h,v 1.31 2001/02/23 17:17:25 roberto Exp roberto $
|
||||
** $Id: lstring.h,v 1.32 2001/06/06 18:00:19 roberto Exp roberto $
|
||||
** String table (keep all strings handled by Lua)
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
|
@ -13,16 +13,6 @@
|
|||
|
||||
|
||||
|
||||
/*
|
||||
** type equivalent to Udata, but with maximum alignment requirements
|
||||
*/
|
||||
union L_UUdata {
|
||||
Udata u;
|
||||
union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** any TString with mark>=FIXMARK is never collected.
|
||||
** Marks>=RESERVEDMARK are used to identify reserved words.
|
||||
|
|
@ -31,10 +21,10 @@ union L_UUdata {
|
|||
#define RESERVEDMARK 3
|
||||
|
||||
|
||||
#define sizestring(l) ((lu_mem)sizeof(union L_UTString)+ \
|
||||
#define sizestring(l) ((lu_mem)sizeof(union TString)+ \
|
||||
((lu_mem)(l)+1)*sizeof(l_char))
|
||||
|
||||
#define sizeudata(l) ((lu_mem)sizeof(union L_UUdata)+(l))
|
||||
#define sizeudata(l) ((lu_mem)sizeof(union Udata)+(l))
|
||||
|
||||
#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
|
||||
#define luaS_newliteral(L, s) (luaS_newlstr(L, l_s("") s, \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue