aboutsummaryrefslogtreecommitdiff
path: root/lstring.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-11-09 17:05:42 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-11-09 17:05:42 -0300
commit024f9064f1b43758eb36aba52547edc0312bf4ba (patch)
tree9d8609112058e885196a581f0736fbdd94f7f94d /lstring.h
parent7f4906f565ab9f8b1125107a3abae3d759f3ecf2 (diff)
downloadlua-024f9064f1b43758eb36aba52547edc0312bf4ba.tar.gz
lua-024f9064f1b43758eb36aba52547edc0312bf4ba.tar.bz2
lua-024f9064f1b43758eb36aba52547edc0312bf4ba.zip
External strings
Strings can use external buffers to store their contents.
Diffstat (limited to 'lstring.h')
-rw-r--r--lstring.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/lstring.h b/lstring.h
index 069e64b7..e321bd43 100644
--- a/lstring.h
+++ b/lstring.h
@@ -26,12 +26,6 @@
26#define sizestrshr(l) \ 26#define sizestrshr(l) \
27 (offsetof(TString, contents) + ((l) + 1) * sizeof(char)) 27 (offsetof(TString, contents) + ((l) + 1) * sizeof(char))
28 28
29/*
30** Size of a long TString: Size of the header plus space for the string
31** itself (including final '\0').
32*/
33#define sizestrlng(l) (sizeof(TString) + ((l) + 1) * sizeof(char))
34
35 29
36#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 30#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
37 (sizeof(s)/sizeof(char))-1)) 31 (sizeof(s)/sizeof(char))-1))
@@ -60,6 +54,8 @@ LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue);
60LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 54LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
61LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); 55LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
62LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); 56LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l);
63 57LUAI_FUNC TString *luaS_newextlstr (lua_State *L,
58 const char *s, size_t len, lua_Alloc falloc, void *ud);
59LUAI_FUNC size_t luaS_sizelngstr (size_t len, int kind);
64 60
65#endif 61#endif