diff options
Diffstat (limited to 'lstring.h')
-rw-r--r-- | lstring.h | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.h,v 1.53 2014/02/19 13:51:09 roberto Exp roberto $ | 2 | ** $Id: lstring.h,v 1.54 2014/03/19 18:51:42 roberto Exp roberto $ |
3 | ** String table (keep all strings handled by Lua) | 3 | ** String table (keep all strings handled by Lua) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -12,7 +12,8 @@ | |||
12 | #include "lstate.h" | 12 | #include "lstate.h" |
13 | 13 | ||
14 | 14 | ||
15 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) | 15 | #define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) |
16 | #define sizestring(s) sizelstring((s)->len) | ||
16 | 17 | ||
17 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) | 18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) |
18 | 19 | ||
@@ -23,13 +24,13 @@ | |||
23 | /* | 24 | /* |
24 | ** test whether a string is a reserved word | 25 | ** test whether a string is a reserved word |
25 | */ | 26 | */ |
26 | #define isreserved(s) ((s)->tsv.tt == LUA_TSHRSTR && (s)->tsv.extra > 0) | 27 | #define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0) |
27 | 28 | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | ** equality for short strings, which are always internalized | 31 | ** equality for short strings, which are always internalized |
31 | */ | 32 | */ |
32 | #define eqshrstr(a,b) check_exp((a)->tsv.tt == LUA_TSHRSTR, (a) == (b)) | 33 | #define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b)) |
33 | 34 | ||
34 | 35 | ||
35 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); | 36 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); |