diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-08 13:24:38 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-08 13:24:38 -0300 |
| commit | 7f4906f565ab9f8b1125107a3abae3d759f3ecf2 (patch) | |
| tree | f1c9c36ce0e96f1e89673bfe25175cbf83523bf6 /lstring.h | |
| parent | b8a9d14032b717f6e5c493a9ec20e3494c9f82a0 (diff) | |
| download | lua-7f4906f565ab9f8b1125107a3abae3d759f3ecf2.tar.gz lua-7f4906f565ab9f8b1125107a3abae3d759f3ecf2.tar.bz2 lua-7f4906f565ab9f8b1125107a3abae3d759f3ecf2.zip | |
Towards external strings
Long strings have a pointer to string contents.
Diffstat (limited to 'lstring.h')
| -rw-r--r-- | lstring.h | 12 |
1 files changed, 10 insertions, 2 deletions
| @@ -20,10 +20,18 @@ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | /* | 22 | /* |
| 23 | ** Size of a TString: Size of the header plus space for the string | 23 | ** Size of a short TString: Size of the header plus space for the string |
| 24 | ** itself (including final '\0'). | 24 | ** itself (including final '\0'). |
| 25 | */ | 25 | */ |
| 26 | #define sizelstring(l) (offsetof(TString, contents) + ((l) + 1) * sizeof(char)) | 26 | #define sizestrshr(l) \ |
| 27 | (offsetof(TString, contents) + ((l) + 1) * sizeof(char)) | ||
| 28 | |||
| 29 | /* | ||
| 30 | ** Size of a long TString: Size of the header plus space for the string | ||
| 31 | ** itself (including final '\0'). | ||
| 32 | */ | ||
| 33 | #define sizestrlng(l) (sizeof(TString) + ((l) + 1) * sizeof(char)) | ||
| 34 | |||
| 27 | 35 | ||
| 28 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ | 36 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ |
| 29 | (sizeof(s)/sizeof(char))-1)) | 37 | (sizeof(s)/sizeof(char))-1)) |
