mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
type 'TString' refers directly to the structure inside the union
(union used only for size purposes)
This commit is contained in:
parent
3511e186cd
commit
ca41b43f53
13 changed files with 102 additions and 104 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lstring.h,v 1.53 2014/02/19 13:51:09 roberto Exp roberto $
|
||||
** $Id: lstring.h,v 1.54 2014/03/19 18:51:42 roberto Exp roberto $
|
||||
** String table (keep all strings handled by Lua)
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
|
@ -12,7 +12,8 @@
|
|||
#include "lstate.h"
|
||||
|
||||
|
||||
#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char))
|
||||
#define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char))
|
||||
#define sizestring(s) sizelstring((s)->len)
|
||||
|
||||
#define sizeudata(u) (sizeof(union Udata)+(u)->len)
|
||||
|
||||
|
|
@ -23,13 +24,13 @@
|
|||
/*
|
||||
** test whether a string is a reserved word
|
||||
*/
|
||||
#define isreserved(s) ((s)->tsv.tt == LUA_TSHRSTR && (s)->tsv.extra > 0)
|
||||
#define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0)
|
||||
|
||||
|
||||
/*
|
||||
** equality for short strings, which are always internalized
|
||||
*/
|
||||
#define eqshrstr(a,b) check_exp((a)->tsv.tt == LUA_TSHRSTR, (a) == (b))
|
||||
#define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b))
|
||||
|
||||
|
||||
LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue