aboutsummaryrefslogtreecommitdiff
path: root/lfunc.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-02-25 10:40:00 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-02-25 10:40:00 -0300
commit38d3bc89093010fa9c460b61a1965d9077b5378f (patch)
tree183158bcdac55fc9a8be5b8011391ef0df3e1d70 /lfunc.h
parent75efc6722bf3bf31adffed44407674f74ac6caed (diff)
downloadlua-38d3bc89093010fa9c460b61a1965d9077b5378f.tar.gz
lua-38d3bc89093010fa9c460b61a1965d9077b5378f.tar.bz2
lua-38d3bc89093010fa9c460b61a1965d9077b5378f.zip
using 'offsetof' to compute the size of parts of a structure
Diffstat (limited to 'lfunc.h')
-rw-r--r--lfunc.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/lfunc.h b/lfunc.h
index dbda3fdf..74a9fc2e 100644
--- a/lfunc.h
+++ b/lfunc.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lfunc.h,v 2.18 2017/06/29 15:06:44 roberto Exp roberto $ 2** $Id: lfunc.h,v 2.19 2018/01/28 15:13:26 roberto Exp roberto $
3** Auxiliary functions to manipulate prototypes and closures 3** Auxiliary functions to manipulate prototypes and closures
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -11,11 +11,11 @@
11#include "lobject.h" 11#include "lobject.h"
12 12
13 13
14#define sizeCclosure(n) (cast_int(sizeof(CClosure)) + \ 14#define sizeCclosure(n) (cast_int(offsetof(CClosure, upvalue)) + \
15 cast_int(sizeof(TValue)*((n)-1))) 15 cast_int(sizeof(TValue)) * (n))
16 16
17#define sizeLclosure(n) (cast_int(sizeof(LClosure)) + \ 17#define sizeLclosure(n) (cast_int(offsetof(LClosure, upvals)) + \
18 cast_int(sizeof(TValue *)*((n)-1))) 18 cast_int(sizeof(TValue *)) * (n))
19 19
20 20
21/* test whether thread is in 'twups' list */ 21/* test whether thread is in 'twups' list */