diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-09 17:05:42 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-09 17:05:42 -0300 |
commit | 024f9064f1b43758eb36aba52547edc0312bf4ba (patch) | |
tree | 9d8609112058e885196a581f0736fbdd94f7f94d /lobject.h | |
parent | 7f4906f565ab9f8b1125107a3abae3d759f3ecf2 (diff) | |
download | lua-024f9064f1b43758eb36aba52547edc0312bf4ba.tar.gz lua-024f9064f1b43758eb36aba52547edc0312bf4ba.tar.bz2 lua-024f9064f1b43758eb36aba52547edc0312bf4ba.zip |
External strings
Strings can use external buffers to store their contents.
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -382,6 +382,12 @@ typedef struct GCObject { | |||
382 | #define setsvalue2n setsvalue | 382 | #define setsvalue2n setsvalue |
383 | 383 | ||
384 | 384 | ||
385 | /* Kinds of long strings (stored in 'shrlen') */ | ||
386 | #define LSTRREG -1 /* regular long string */ | ||
387 | #define LSTRFIX -2 /* fixed external long string */ | ||
388 | #define LSTRMEM -3 /* external long string with deallocation */ | ||
389 | |||
390 | |||
385 | /* | 391 | /* |
386 | ** Header for a string value. | 392 | ** Header for a string value. |
387 | */ | 393 | */ |
@@ -395,6 +401,8 @@ typedef struct TString { | |||
395 | struct TString *hnext; /* linked list for hash table */ | 401 | struct TString *hnext; /* linked list for hash table */ |
396 | } u; | 402 | } u; |
397 | char *contents; /* pointer to content in long strings */ | 403 | char *contents; /* pointer to content in long strings */ |
404 | lua_Alloc falloc; /* deallocation function for external strings */ | ||
405 | void *ud; /* user data for external strings */ | ||
398 | } TString; | 406 | } TString; |
399 | 407 | ||
400 | 408 | ||