diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-09 17:05:42 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-09 17:05:42 -0300 |
commit | 024f9064f1b43758eb36aba52547edc0312bf4ba (patch) | |
tree | 9d8609112058e885196a581f0736fbdd94f7f94d /lstring.h | |
parent | 7f4906f565ab9f8b1125107a3abae3d759f3ecf2 (diff) | |
download | lua-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.h | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -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); | |||
60 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); | 54 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); |
61 | LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); | 55 | LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); |
62 | LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); | 56 | LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); |
63 | 57 | LUAI_FUNC TString *luaS_newextlstr (lua_State *L, | |
58 | const char *s, size_t len, lua_Alloc falloc, void *ud); | ||
59 | LUAI_FUNC size_t luaS_sizelngstr (size_t len, int kind); | ||
64 | 60 | ||
65 | #endif | 61 | #endif |