aboutsummaryrefslogtreecommitdiff
path: root/ltable.h
diff options
context:
space:
mode:
Diffstat (limited to 'ltable.h')
-rw-r--r--ltable.h18
1 files changed, 4 insertions, 14 deletions
diff --git a/ltable.h b/ltable.h
index ee22cf62..88f90636 100644
--- a/ltable.h
+++ b/ltable.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.h,v 2.23 2016/12/22 13:08:50 roberto Exp roberto $ 2** $Id: ltable.h,v 2.24 2017/05/19 12:48:15 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -12,18 +12,9 @@
12 12
13#define gnode(t,i) (&(t)->node[i]) 13#define gnode(t,i) (&(t)->node[i])
14#define gval(n) (&(n)->i_val) 14#define gval(n) (&(n)->i_val)
15#define gnext(n) ((n)->i_key.nk.next) 15#define gnext(n) ((n)->u.next)
16 16
17 17
18/* 'const' to avoid wrong writings that can mess up field 'next' */
19#define gkey(n) cast(const TValue*, (&(n)->i_key.tvk))
20
21/*
22** writable version of 'gkey'; allows updates to individual fields,
23** but not to the whole (which has incompatible type)
24*/
25#define wgkey(n) (&(n)->i_key.nk)
26
27#define invalidateTMcache(t) ((t)->flags = 0) 18#define invalidateTMcache(t) ((t)->flags = 0)
28 19
29 20
@@ -35,9 +26,8 @@
35#define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) 26#define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t))
36 27
37 28
38/* returns the key, given the value of a table entry */ 29/* returns the Node, given the value of a table entry */
39#define keyfromval(v) \ 30#define nodefromval(v) cast(Node *, (v))
40 (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val))))
41 31
42 32
43LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); 33LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key);