mirror of
https://github.com/lua/lua
synced 2026-09-27 00:28:25 +03:00
External strings
Strings can use external buffers to store their contents.
This commit is contained in:
parent
7f4906f565
commit
024f9064f1
9 changed files with 195 additions and 14 deletions
10
lstring.h
10
lstring.h
|
|
@ -26,12 +26,6 @@
|
|||
#define sizestrshr(l) \
|
||||
(offsetof(TString, contents) + ((l) + 1) * sizeof(char))
|
||||
|
||||
/*
|
||||
** Size of a long TString: Size of the header plus space for the string
|
||||
** itself (including final '\0').
|
||||
*/
|
||||
#define sizestrlng(l) (sizeof(TString) + ((l) + 1) * sizeof(char))
|
||||
|
||||
|
||||
#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
|
||||
(sizeof(s)/sizeof(char))-1))
|
||||
|
|
@ -60,6 +54,8 @@ LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue);
|
|||
LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
|
||||
LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
|
||||
LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l);
|
||||
|
||||
LUAI_FUNC TString *luaS_newextlstr (lua_State *L,
|
||||
const char *s, size_t len, lua_Alloc falloc, void *ud);
|
||||
LUAI_FUNC size_t luaS_sizelngstr (size_t len, int kind);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue