aboutsummaryrefslogtreecommitdiff
path: root/lapi.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-03-11 14:05:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-03-11 14:05:06 -0300
commit65b07dd53d7938a60112fc4473f5cad3473e3534 (patch)
tree469c75dba3b194c494b6ad6a30ca44e7e8354ef5 /lapi.h
parent7237eb3f1c480d6bc7fe2832ddd36f2137fb69d9 (diff)
downloadlua-65b07dd53d7938a60112fc4473f5cad3473e3534.tar.gz
lua-65b07dd53d7938a60112fc4473f5cad3473e3534.tar.bz2
lua-65b07dd53d7938a60112fc4473f5cad3473e3534.zip
API asserts for illegal pops of to-be-closed variables
Diffstat (limited to 'lapi.h')
-rw-r--r--lapi.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/lapi.h b/lapi.h
index 43845648..757bf3d2 100644
--- a/lapi.h
+++ b/lapi.h
@@ -29,8 +29,18 @@
29 29
30/* Ensure the stack has at least 'n' elements */ 30/* Ensure the stack has at least 'n' elements */
31#define api_checknelems(L,n) \ 31#define api_checknelems(L,n) \
32 api_check(L, (n) < (L->top.p - L->ci->func.p), \ 32 api_check(L, (n) < (L->top.p - L->ci->func.p), \
33 "not enough elements in the stack") 33 "not enough elements in the stack")
34
35
36/* Ensure the stack has at least 'n' elements to be popped. (Some
37** functions only update a slot after checking it for popping, but that
38** is only an optimization for a pop followed by a push.)
39*/
40#define api_checkpop(L,n) \
41 api_check(L, (n) < L->top.p - L->ci->func.p && \
42 L->tbclist.p < L->top.p - (n), \
43 "not enough free elements in the stack")
34 44
35 45
36/* 46/*