aboutsummaryrefslogtreecommitdiff
path: root/lstring.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-12-28 10:55:41 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-12-28 10:55:41 -0200
commit0183b8030c80f57b87874ff7867ccdb172d9d3dc (patch)
tree1033b5a84489a2f1f1bd210b1b120155cd7aeed7 /lstring.h
parent8c49e198654567f770a7d5081b886a7c35201d81 (diff)
downloadlua-0183b8030c80f57b87874ff7867ccdb172d9d3dc.tar.gz
lua-0183b8030c80f57b87874ff7867ccdb172d9d3dc.tar.bz2
lua-0183b8030c80f57b87874ff7867ccdb172d9d3dc.zip
`free' gets size of the block: complete control over memory use
Diffstat (limited to 'lstring.h')
-rw-r--r--lstring.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/lstring.h b/lstring.h
index af733b74..330d80e1 100644
--- a/lstring.h
+++ b/lstring.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstring.h,v 1.24 2000/10/30 17:49:19 roberto Exp roberto $ 2** $Id: lstring.h,v 1.25 2000/11/24 17:39:56 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*/
@@ -12,6 +12,17 @@
12#include "lstate.h" 12#include "lstate.h"
13 13
14 14
15
16/*
17** type equivalent to TString, but with maximum alignment requirements
18*/
19union L_UTString {
20 TString ts;
21 union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
22};
23
24
25
15/* 26/*
16** any TString with mark>=FIXMARK is never collected. 27** any TString with mark>=FIXMARK is never collected.
17** Marks>=RESERVEDMARK are used to identify reserved words. 28** Marks>=RESERVEDMARK are used to identify reserved words.
@@ -23,6 +34,8 @@
23#define sizestring(l) ((lint32)sizeof(TString) + \ 34#define sizestring(l) ((lint32)sizeof(TString) + \
24 ((lint32)(l+1)-TSPACK)*(lint32)sizeof(char)) 35 ((lint32)(l+1)-TSPACK)*(lint32)sizeof(char))
25 36
37#define sizeudata(l) ((luint32)sizeof(union L_UTString)+(l))
38
26 39
27void luaS_init (lua_State *L); 40void luaS_init (lua_State *L);
28void luaS_resize (lua_State *L, stringtable *tb, int newsize); 41void luaS_resize (lua_State *L, stringtable *tb, int newsize);