diff options
Diffstat (limited to 'apps/plugins/lua/lstring.h')
-rw-r--r-- | apps/plugins/lua/lstring.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/apps/plugins/lua/lstring.h b/apps/plugins/lua/lstring.h index c88e4c12a9..8ca69b8de3 100644 --- a/apps/plugins/lua/lstring.h +++ b/apps/plugins/lua/lstring.h | |||
@@ -12,20 +12,29 @@ | |||
12 | #include "lobject.h" | 12 | #include "lobject.h" |
13 | #include "lstate.h" | 13 | #include "lstate.h" |
14 | 14 | ||
15 | 15 | /* ROCKLUA ADDED */ | |
16 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) | 16 | #define TSTR_INBLOB 0 /* string will be allocated at end of tstring struct */ |
17 | #define TSTR_INBIN 1 /* string is static within binary, pointer stored */ | ||
18 | #define TSTR_FIXED 2 /* string won't be collected for duration of L state */ | ||
19 | #define TSTR_CHKSZ 4 /* luaS_newllocstr shall determine size of string */ | ||
20 | #define TSTR_ISLIT 8 | TSTR_INBIN /* literal string static within binary */ | ||
21 | #define sizetstring(t, l) (sizeof(union TString) + (testbits((t), TSTR_INBIN) ? \ | ||
22 | sizeof(const char **) : ((l)+1)*sizeof(char))) | ||
17 | 23 | ||
18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) | 24 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) |
19 | 25 | ||
20 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) | 26 | #define luaS_new(L, s) (luaS_newllocstr(L, s, 0, TSTR_INBLOB | TSTR_CHKSZ)) |
21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ | 27 | #define luaS_newlstr(L, s, len) (luaS_newllocstr(L, s, len, TSTR_INBLOB)) |
22 | (sizeof(s)/sizeof(char))-1)) | 28 | #define luaS_newlloc(L, s, t) (luaS_newllocstr(L, s, 0, ((t) | TSTR_CHKSZ))) |
29 | #define luaS_newliteral(L, s) (luaS_newllocstr(L, "" s, \ | ||
30 | (sizeof(s)/sizeof(char))-1, TSTR_ISLIT)) | ||
23 | 31 | ||
24 | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) | 32 | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) |
25 | 33 | ||
26 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); | 34 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); |
27 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); | 35 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); |
28 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); | 36 | /* ROCKLUA ADDED */ |
29 | 37 | LUAI_FUNC TString *luaS_newllocstr (lua_State *L, | |
38 | const char *str, size_t l, char type); | ||
30 | 39 | ||
31 | #endif | 40 | #endif |