From 73996edb59a5b03d25650033729eb991cbd29c33 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 31 Oct 2018 14:10:01 +1100 Subject: src/openssl.c: Add checkbool() to complement optbool() --- src/openssl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') 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() */ -- cgit v1.2.3-59-g8ed1b