aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/keeper.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/keeper.cpp b/src/keeper.cpp
index 0875b87..48f0166 100644
--- a/src/keeper.cpp
+++ b/src/keeper.cpp
@@ -64,7 +64,7 @@ class keeper_fifo
64 [[nodiscard]] static void* operator new([[maybe_unused]] size_t size_, lua_State* L) noexcept { return lua_newuserdatauv<keeper_fifo>(L, 1); } 64 [[nodiscard]] static void* operator new([[maybe_unused]] size_t size_, lua_State* L) noexcept { return lua_newuserdatauv<keeper_fifo>(L, 1); }
65 // always embedded somewhere else or "in-place constructed" as a full userdata 65 // always embedded somewhere else or "in-place constructed" as a full userdata
66 // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception 66 // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception
67 static void operator delete([[maybe_unused]] void* p_, lua_State* L) { ASSERT_L(!"should never be called") }; 67 static void operator delete([[maybe_unused]] void* p_, lua_State* L_) { LUA_ASSERT(L_, !"should never be called"); }
68 68
69 [[nodiscard]] static keeper_fifo* getPtr(lua_State* L, int idx_) 69 [[nodiscard]] static keeper_fifo* getPtr(lua_State* L, int idx_)
70 { 70 {
@@ -146,7 +146,7 @@ static void fifo_peek(lua_State* L, keeper_fifo* fifo_, int count_)
146// out: remove the fifo from the stack, push as many items as required on the stack (function assumes they exist in sufficient number) 146// out: remove the fifo from the stack, push as many items as required on the stack (function assumes they exist in sufficient number)
147static void fifo_pop( lua_State* L, keeper_fifo* fifo_, int count_) 147static void fifo_pop( lua_State* L, keeper_fifo* fifo_, int count_)
148{ 148{
149 ASSERT_L(lua_istable(L, -1)); 149 LUA_ASSERT(L, lua_istable(L, -1));
150 int const fifo_idx{ lua_gettop(L) }; // ... fifotbl 150 int const fifo_idx{ lua_gettop(L) }; // ... fifotbl
151 // each iteration pushes a value on the stack! 151 // each iteration pushes a value on the stack!
152 STACK_GROW(L, count_ + 2); 152 STACK_GROW(L, count_ + 2);
@@ -582,7 +582,7 @@ int keepercall_count(lua_State* L)
582 } // all keys are exhausted // out fifos 582 } // all keys are exhausted // out fifos
583 lua_pop(L, 1); // out 583 lua_pop(L, 1); // out
584 } 584 }
585 ASSERT_L(lua_gettop(L) == 1); 585 LUA_ASSERT(L, lua_gettop(L) == 1);
586 return 1; 586 return 1;
587} 587}
588 588
@@ -651,7 +651,7 @@ void close_keepers(Universe* U)
651 */ 651 */
652void init_keepers(Universe* U, lua_State* L) 652void init_keepers(Universe* U, lua_State* L)
653{ 653{
654 ASSERT_L(lua_gettop(L) == 1 && lua_istable(L, 1)); 654 LUA_ASSERT(L, lua_gettop(L) == 1 && lua_istable(L, 1));
655 STACK_CHECK_START_REL(L, 0); // L K 655 STACK_CHECK_START_REL(L, 0); // L K
656 lua_getfield(L, 1, "nb_keepers"); // settings nb_keepers 656 lua_getfield(L, 1, "nb_keepers"); // settings nb_keepers
657 int const nb_keepers{ static_cast<int>(lua_tointeger(L, -1)) }; 657 int const nb_keepers{ static_cast<int>(lua_tointeger(L, -1)) };
@@ -838,7 +838,7 @@ KeeperCallResult keeper_call(Universe* U, lua_State* K, keeper_api_t func_, lua_
838 int const args{ starting_index ? (lua_gettop(L) - starting_index + 1) : 0 }; 838 int const args{ starting_index ? (lua_gettop(L) - starting_index + 1) : 0 };
839 int const top_K{ lua_gettop(K) }; 839 int const top_K{ lua_gettop(K) };
840 // if we didn't do anything wrong, the keeper stack should be clean 840 // if we didn't do anything wrong, the keeper stack should be clean
841 ASSERT_L(lua_gettop(K) == 0); 841 LUA_ASSERT(L, lua_gettop(K) == 0);
842 842
843 STACK_GROW(K, 2); 843 STACK_GROW(K, 2);
844 PUSH_KEEPER_FUNC(K, func_); // func_ 844 PUSH_KEEPER_FUNC(K, func_); // func_