xref: /redis-3.2.3/deps/lua/src/lstring.h (revision 21d3294c)
1*21d3294cSantirez /*
2*21d3294cSantirez ** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $
3*21d3294cSantirez ** String table (keep all strings handled by Lua)
4*21d3294cSantirez ** See Copyright Notice in lua.h
5*21d3294cSantirez */
6*21d3294cSantirez 
7*21d3294cSantirez #ifndef lstring_h
8*21d3294cSantirez #define lstring_h
9*21d3294cSantirez 
10*21d3294cSantirez 
11*21d3294cSantirez #include "lgc.h"
12*21d3294cSantirez #include "lobject.h"
13*21d3294cSantirez #include "lstate.h"
14*21d3294cSantirez 
15*21d3294cSantirez 
16*21d3294cSantirez #define sizestring(s)	(sizeof(union TString)+((s)->len+1)*sizeof(char))
17*21d3294cSantirez 
18*21d3294cSantirez #define sizeudata(u)	(sizeof(union Udata)+(u)->len)
19*21d3294cSantirez 
20*21d3294cSantirez #define luaS_new(L, s)	(luaS_newlstr(L, s, strlen(s)))
21*21d3294cSantirez #define luaS_newliteral(L, s)	(luaS_newlstr(L, "" s, \
22*21d3294cSantirez                                  (sizeof(s)/sizeof(char))-1))
23*21d3294cSantirez 
24*21d3294cSantirez #define luaS_fix(s)	l_setbit((s)->tsv.marked, FIXEDBIT)
25*21d3294cSantirez 
26*21d3294cSantirez LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
27*21d3294cSantirez LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
28*21d3294cSantirez LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
29*21d3294cSantirez 
30*21d3294cSantirez 
31*21d3294cSantirez #endif
32