Towards external strings

Long strings have a pointer to string contents.
This commit is contained in:
Roberto Ierusalimschy
2023-11-08 13:24:38 -03:00
parent b8a9d14032
commit 7f4906f565
4 changed files with 36 additions and 22 deletions

View File

@@ -20,10 +20,18 @@
/*
** Size of a TString: Size of the header plus space for the string
** Size of a short TString: Size of the header plus space for the string
** itself (including final '\0').
*/
#define sizelstring(l) (offsetof(TString, contents) + ((l) + 1) * sizeof(char))
#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))