diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-18 10:36:14 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-18 10:36:14 -0300 |
| commit | ca41b43f53562e64abe433d6346d174c92548603 (patch) | |
| tree | 03f7a99f76359fc1e0bbc45fc13e579ff2aafabb /lstring.h | |
| parent | 3511e186cde4b78f268d17199d0f46fb3eaa9638 (diff) | |
| download | lua-ca41b43f53562e64abe433d6346d174c92548603.tar.gz lua-ca41b43f53562e64abe433d6346d174c92548603.tar.bz2 lua-ca41b43f53562e64abe433d6346d174c92548603.zip | |
type 'TString' refers directly to the structure inside the union
(union used only for size purposes)
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); |
