]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/ffimodule.c: replace asserts
authorTomas Krizek <tomas.krizek@nic.cz>
Wed, 24 Mar 2021 16:44:42 +0000 (17:44 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 25 May 2021 10:44:37 +0000 (12:44 +0200)
daemon/ffimodule.c

index 44809f9485bc09de0cd50136cc45488d616a5b6f..d9487e00ab8c2e23253926b52023cdb1e4ef2d81 100644 (file)
@@ -101,7 +101,7 @@ static int l_ffi_call_layer(kr_layer_t *ctx, int slot_ix)
 {
        const int wrap_slot = l_ffi_wrap_slots[slot_ix];
        const int cb_slot = ctx->api->cb_slots[slot_ix];
-       assert(wrap_slot > 0 && cb_slot > 0);
+       kr_require(wrap_slot > 0 && cb_slot > 0);
        lua_State *L = the_worker->engine->L;
        lua_rawgeti(L, LUA_REGISTRYINDEX, wrap_slot);
        lua_rawgeti(L, LUA_REGISTRYINDEX, cb_slot);
@@ -129,9 +129,8 @@ static int l_ffi_call_layer(kr_layer_t *ctx, int slot_ix)
 
        } else if (lua_isnil(L, -1)) { /* Don't change state. */
 
-       } else if (lua_isthread(L, -1)) { /* Continuations */
+       } else if (!kr_assume(!lua_isthread(L, -1))) { /* Continuations */
                /* TODO: unused, possibly in a bad shape.  Meant KR_STATE_YIELD? */
-               assert(!ENOTSUP);
                if (l_ffi_defer(lua_tothread(L, -1)) != 0)
                        state = KR_STATE_FAIL;