From 4da22c62449fc464301460ca1f5d2e0d7668fcc4 Mon Sep 17 00:00:00 2001 From: Tomas Krizek Date: Wed, 24 Mar 2021 17:44:42 +0100 Subject: [PATCH] daemon/ffimodule.c: replace asserts --- daemon/ffimodule.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/daemon/ffimodule.c b/daemon/ffimodule.c index 44809f948..d9487e00a 100644 --- a/daemon/ffimodule.c +++ b/daemon/ffimodule.c @@ -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; -- 2.47.3