From 7f4906f565ab9f8b1125107a3abae3d759f3ecf2 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 8 Nov 2023 13:24:38 -0300 Subject: Towards external strings Long strings have a pointer to string contents. --- lstring.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lstring.h') diff --git a/lstring.h b/lstring.h index 450c2390..069e64b7 100644 --- a/lstring.h +++ b/lstring.h @@ -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)) -- cgit v1.2.3-55-g6feb