aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-10-31 14:10:01 +1100
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-10-31 14:10:01 +1100
commit73996edb59a5b03d25650033729eb991cbd29c33 (patch)
treef33cdafccb1942a206a8cf048932e46e5dd8b4a2 /src
parentc0c334e88bffc74a97b1316d0c55cedd4b041ccb (diff)
downloadluaossl-73996edb59a5b03d25650033729eb991cbd29c33.tar.gz
luaossl-73996edb59a5b03d25650033729eb991cbd29c33.tar.bz2
luaossl-73996edb59a5b03d25650033729eb991cbd29c33.zip
src/openssl.c: Add checkbool() to complement optbool()
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 6b6d5cd..ba97113 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -611,11 +611,16 @@ static const char *xitoa(char *dst, size_t lim, long i) {
} /* xitoa() */
+static _Bool checkbool(lua_State *L, int idx) {
+ luaL_checktype(L, idx, LUA_TBOOLEAN);
+ return lua_toboolean(L, idx);
+} /* optbool() */
+
+
static _Bool optbool(lua_State *L, int idx, _Bool d) {
if (lua_isnoneornil(L, idx))
return d;
- luaL_checktype(L, idx, LUA_TBOOLEAN);
- return lua_toboolean(L, idx);
+ return checkbool(L, idx);
} /* optbool() */