diff options
author | daurnimator <quae@daurnimator.com> | 2018-10-31 14:10:01 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-10-31 14:10:01 +1100 |
commit | 73996edb59a5b03d25650033729eb991cbd29c33 (patch) | |
tree | f33cdafccb1942a206a8cf048932e46e5dd8b4a2 | |
parent | c0c334e88bffc74a97b1316d0c55cedd4b041ccb (diff) | |
download | luaossl-73996edb59a5b03d25650033729eb991cbd29c33.tar.gz luaossl-73996edb59a5b03d25650033729eb991cbd29c33.tar.bz2 luaossl-73996edb59a5b03d25650033729eb991cbd29c33.zip |
src/openssl.c: Add checkbool() to complement optbool()
-rw-r--r-- | src/openssl.c | 9 |
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() */ |