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. --- lobject.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lobject.h') diff --git a/lobject.h b/lobject.h index f76d26a6..8688a842 100644 --- a/lobject.h +++ b/lobject.h @@ -382,6 +382,12 @@ typedef struct GCObject { #define setsvalue2n setsvalue +/* Kinds of long strings (stored in 'shrlen') */ +#define LSTRREG -1 /* regular long string */ +#define LSTRFIX -2 /* fixed external long string */ +#define LSTRMEM -3 /* external long string with deallocation */ + + /* ** Header for a string value. */ @@ -395,6 +401,8 @@ typedef struct TString { struct TString *hnext; /* linked list for hash table */ } u; char *contents; /* pointer to content in long strings */ + lua_Alloc falloc; /* deallocation function for external strings */ + void *ud; /* user data for external strings */ } TString; -- cgit v1.2.3-55-g6feb