aboutsummaryrefslogtreecommitdiff
path: root/lfunc.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-12-03 10:53:46 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-12-03 10:53:46 -0300
commit975d4e0592f980aef09c432302496d834249b6a7 (patch)
tree6cedfb17d1c001116df4a6f18510473fbfe28727 /lfunc.h
parent04e495403ba66e88abfb5cc4cf1887f094eea57f (diff)
downloadlua-975d4e0592f980aef09c432302496d834249b6a7.tar.gz
lua-975d4e0592f980aef09c432302496d834249b6a7.tar.bz2
lua-975d4e0592f980aef09c432302496d834249b6a7.zip
Fix in the definition of 'sizeLclosure'
The array at the end of a Lua closure has pointers to upvalues, not to tagged values. This bug cannot cause any issue: The ISO C standard requires that all pointers to structures have the same representation, so sizeof(TValue*) must be equal to sizeof(UpVal*).
Diffstat (limited to 'lfunc.h')
-rw-r--r--lfunc.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lfunc.h b/lfunc.h
index b981edeb..342389e4 100644
--- a/lfunc.h
+++ b/lfunc.h
@@ -15,7 +15,7 @@
15 (offsetof(CClosure, upvalue) + sizeof(TValue) * cast_uint(n)) 15 (offsetof(CClosure, upvalue) + sizeof(TValue) * cast_uint(n))
16 16
17#define sizeLclosure(n) \ 17#define sizeLclosure(n) \
18 (offsetof(LClosure, upvals) + sizeof(TValue *) * cast_uint(n)) 18 (offsetof(LClosure, upvals) + sizeof(UpVal *) * cast_uint(n))
19 19
20 20
21/* test whether thread is in 'twups' list */ 21/* test whether thread is in 'twups' list */