aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.cpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-05-13 18:00:21 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-05-13 18:00:21 +0200
commit6b1911b8a3eb7305e6225485191d5e3bccb3b25c (patch)
tree6b4fb894b4475b3d74bc55e7b7daa5e6761a93c8 /src/keeper.cpp
parent89598b602f57f17aabb8d9dbd2d87eb5176160f6 (diff)
downloadlanes-6b1911b8a3eb7305e6225485191d5e3bccb3b25c.tar.gz
lanes-6b1911b8a3eb7305e6225485191d5e3bccb3b25c.tar.bz2
lanes-6b1911b8a3eb7305e6225485191d5e3bccb3b25c.zip
Progressively applying the coding rules
Diffstat (limited to 'src/keeper.cpp')
-rw-r--r--src/keeper.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/keeper.cpp b/src/keeper.cpp
index 39d2e85..dcfa2ec 100644
--- a/src/keeper.cpp
+++ b/src/keeper.cpp
@@ -738,9 +738,9 @@ void keeper_toggle_nil_sentinels(lua_State* L_, int start_, LookupMode const mod
738 * 738 *
739 * Returns: number of return values (pushed to 'L'), unset in case of error 739 * Returns: number of return values (pushed to 'L'), unset in case of error
740 */ 740 */
741KeeperCallResult keeper_call(Universe* U_, KeeperState K_, keeper_api_t func_, lua_State* L_, void* linda_, int starting_index_) 741KeeperCallResult keeper_call(KeeperState K_, keeper_api_t func_, lua_State* L_, Linda* linda_, int starting_index_)
742{ 742{
743 KeeperCallResult _result{}; 743 KeeperCallResult _result;
744 int const _args{ starting_index_ ? (lua_gettop(L_) - starting_index_ + 1) : 0 }; // L: ... args... K_: 744 int const _args{ starting_index_ ? (lua_gettop(L_) - starting_index_ + 1) : 0 }; // L: ... args... K_:
745 int const _top_K{ lua_gettop(K_) }; 745 int const _top_K{ lua_gettop(K_) };
746 // if we didn't do anything wrong, the keeper stack should be clean 746 // if we didn't do anything wrong, the keeper stack should be clean
@@ -751,7 +751,7 @@ KeeperCallResult keeper_call(Universe* U_, KeeperState K_, keeper_api_t func_, l
751 lua_pushlightuserdata(K_, linda_); // L: ... args... K_: func_ linda 751 lua_pushlightuserdata(K_, linda_); // L: ... args... K_: func_ linda
752 if ( 752 if (
753 (_args == 0) || 753 (_args == 0) ||
754 (InterCopyContext{ U_, DestState{ K_ }, SourceState{ L_ }, {}, {}, {}, LookupMode::ToKeeper, {} }.inter_copy(_args) == InterCopyResult::Success) 754 (InterCopyContext{ linda_->U, DestState{ K_ }, SourceState{ L_ }, {}, {}, {}, LookupMode::ToKeeper, {} }.inter_copy(_args) == InterCopyResult::Success)
755 ) { // L: ... args... K_: func_ linda args... 755 ) { // L: ... args... K_: func_ linda args...
756 lua_call(K_, 1 + _args, LUA_MULTRET); // L: ... args... K_: result... 756 lua_call(K_, 1 + _args, LUA_MULTRET); // L: ... args... K_: result...
757 int const retvals{ lua_gettop(K_) - _top_K }; 757 int const retvals{ lua_gettop(K_) - _top_K };
@@ -761,7 +761,7 @@ KeeperCallResult keeper_call(Universe* U_, KeeperState K_, keeper_api_t func_, l
761 // when attempting to grab the mutex again (WINVER <= 0x400 does this, but locks just fine, I don't know about pthread) 761 // when attempting to grab the mutex again (WINVER <= 0x400 does this, but locks just fine, I don't know about pthread)
762 if ( 762 if (
763 (retvals == 0) || 763 (retvals == 0) ||
764 (InterCopyContext{ U_, DestState{ L_ }, SourceState{ K_ }, {}, {}, {}, LookupMode::FromKeeper, {} }.inter_move(retvals) == InterCopyResult::Success) 764 (InterCopyContext{ linda_->U, DestState{ L_ }, SourceState{ K_ }, {}, {}, {}, LookupMode::FromKeeper, {} }.inter_move(retvals) == InterCopyResult::Success)
765 ) { // L: ... args... result... K_: result... 765 ) { // L: ... args... result... K_: result...
766 _result.emplace(retvals); 766 _result.emplace(retvals);
767 } 767 }
@@ -772,7 +772,7 @@ KeeperCallResult keeper_call(Universe* U_, KeeperState K_, keeper_api_t func_, l
772 // don't do this for this particular function, as it is only called during Linda destruction, and we don't want to raise an error, ever 772 // don't do this for this particular function, as it is only called during Linda destruction, and we don't want to raise an error, ever
773 if (func_ != KEEPER_API(clear)) [[unlikely]] { 773 if (func_ != KEEPER_API(clear)) [[unlikely]] {
774 // since keeper state GC is stopped, let's run a step once in a while if required 774 // since keeper state GC is stopped, let's run a step once in a while if required
775 int const _gc_threshold{ U_->keepers->gc_threshold }; 775 int const _gc_threshold{ linda_->U->keepers->gc_threshold };
776 if (_gc_threshold == 0) [[unlikely]] { 776 if (_gc_threshold == 0) [[unlikely]] {
777 lua_gc(K_, LUA_GCSTEP, 0); 777 lua_gc(K_, LUA_GCSTEP, 0);
778 } else if (_gc_threshold > 0) [[likely]] { 778 } else if (_gc_threshold > 0) [[likely]] {