mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
Towards external strings
Long strings have a pointer to string contents.
This commit is contained in:
parent
b8a9d14032
commit
7f4906f565
4 changed files with 36 additions and 22 deletions
12
lstring.h
12
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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue