From 024f9064f1b43758eb36aba52547edc0312bf4ba Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 9 Nov 2023 17:05:42 -0300 Subject: External strings Strings can use external buffers to store their contents. --- lstring.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lstring.h') diff --git a/lstring.h b/lstring.h index 069e64b7..e321bd43 100644 --- a/lstring.h +++ b/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 -- cgit v1.2.3-55-g6feb