diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-05 16:07:08 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-05 16:07:08 +0200 |
commit | 4670b7deee3eeca20f72d91d9fb7094b51348956 (patch) | |
tree | 7064c7de946cfa717e128dc680756ecd6dc4e13f /src/universe.cpp | |
parent | b6d344fe7991b525958a5825fbd22d7c529d21cc (diff) | |
download | lanes-4670b7deee3eeca20f72d91d9fb7094b51348956.tar.gz lanes-4670b7deee3eeca20f72d91d9fb7094b51348956.tar.bz2 lanes-4670b7deee3eeca20f72d91d9fb7094b51348956.zip |
Modernize compat
Diffstat (limited to 'src/universe.cpp')
-rw-r--r-- | src/universe.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/universe.cpp b/src/universe.cpp index 5a52f7e..b4d54b2 100644 --- a/src/universe.cpp +++ b/src/universe.cpp | |||
@@ -136,7 +136,7 @@ Universe::Universe() | |||
136 | 136 | ||
137 | // Initialize 'timerLinda'; a common Linda object shared by all states | 137 | // Initialize 'timerLinda'; a common Linda object shared by all states |
138 | lua_pushcfunction(L_, LG_linda); // L_: settings lanes.linda | 138 | lua_pushcfunction(L_, LG_linda); // L_: settings lanes.linda |
139 | std::ignore = lua_pushstringview(L_, "lanes-timer"); // L_: settings lanes.linda "lanes-timer" | 139 | std::ignore = luaG_pushstringview(L_, "lanes-timer"); // L_: settings lanes.linda "lanes-timer" |
140 | lua_pushinteger(L_, 0); // L_: settings lanes.linda "lanes-timer" 0 | 140 | lua_pushinteger(L_, 0); // L_: settings lanes.linda "lanes-timer" 0 |
141 | lua_call(L_, 2, 1); // L_: settings linda | 141 | lua_call(L_, 2, 1); // L_: settings linda |
142 | STACK_CHECK(L_, 1); | 142 | STACK_CHECK(L_, 1); |
@@ -195,7 +195,7 @@ void Universe::initializeAllocatorFunction(lua_State* const L_) | |||
195 | // when we transfer the config table in newly created Lua states | 195 | // when we transfer the config table in newly created Lua states |
196 | lua_pushnil(L_); // L_: settings allocator nil | 196 | lua_pushnil(L_); // L_: settings allocator nil |
197 | lua_setfield(L_, -3, "allocator"); // L_: settings allocator | 197 | lua_setfield(L_, -3, "allocator"); // L_: settings allocator |
198 | } else if (lua_type(L_, -1) == LUA_TSTRING) { // should be "protected" | 198 | } else if (luaG_type(L_, -1) == LuaType::STRING) { // should be "protected" |
199 | LUA_ASSERT(L_, strcmp(lua_tostring(L_, -1), "protected") == 0); | 199 | LUA_ASSERT(L_, strcmp(lua_tostring(L_, -1), "protected") == 0); |
200 | // set the original allocator to call from inside protection by the mutex | 200 | // set the original allocator to call from inside protection by the mutex |
201 | protectedAllocator.initFrom(L_); | 201 | protectedAllocator.initFrom(L_); |
@@ -211,7 +211,7 @@ void Universe::initializeAllocatorFunction(lua_State* const L_) | |||
211 | STACK_CHECK(L_, 1); | 211 | STACK_CHECK(L_, 1); |
212 | 212 | ||
213 | std::ignore = luaG_getfield(L_, -1, "internal_allocator"); // L_: settings "libc"|"allocator" | 213 | std::ignore = luaG_getfield(L_, -1, "internal_allocator"); // L_: settings "libc"|"allocator" |
214 | std::string_view const _allocator{ lua_tostringview(L_, -1) }; | 214 | std::string_view const _allocator{ luaG_tostringview(L_, -1) }; |
215 | if (_allocator == "libc") { | 215 | if (_allocator == "libc") { |
216 | internalAllocator = AllocatorDefinition{ libc_lua_Alloc, nullptr }; | 216 | internalAllocator = AllocatorDefinition{ libc_lua_Alloc, nullptr }; |
217 | } else if (provideAllocator == luaG_provide_protected_allocator) { | 217 | } else if (provideAllocator == luaG_provide_protected_allocator) { |
@@ -236,7 +236,7 @@ int Universe::InitializeFinalizer(lua_State* const L_) | |||
236 | 236 | ||
237 | // make sure we are only called from the Master Lua State! | 237 | // make sure we are only called from the Master Lua State! |
238 | kUniverseFullRegKey.pushValue(L_); // L_: f U | 238 | kUniverseFullRegKey.pushValue(L_); // L_: f U |
239 | if (lua_type_as_enum(L_, -1) != LuaType::USERDATA) { | 239 | if (luaG_type(L_, -1) != LuaType::USERDATA) { |
240 | raise_luaL_error(L_, "lanes.%s called from inside a lane", kFinally); | 240 | raise_luaL_error(L_, "lanes.%s called from inside a lane", kFinally); |
241 | } | 241 | } |
242 | lua_pop(L_, 1); // L_: f | 242 | lua_pop(L_, 1); // L_: f |
@@ -318,7 +318,7 @@ void Universe::terminateFreeRunningLanes(lua_State* const L_, lua_Duration const | |||
318 | LUAG_FUNC(universe_gc) | 318 | LUAG_FUNC(universe_gc) |
319 | { | 319 | { |
320 | lua_Duration const _shutdown_timeout{ lua_tonumber(L_, lua_upvalueindex(1)) }; | 320 | lua_Duration const _shutdown_timeout{ lua_tonumber(L_, lua_upvalueindex(1)) }; |
321 | std::string_view const _op_string{ lua_tostringview(L_, lua_upvalueindex(2)) }; | 321 | std::string_view const _op_string{ luaG_tostringview(L_, lua_upvalueindex(2)) }; |
322 | STACK_CHECK_START_ABS(L_, 1); | 322 | STACK_CHECK_START_ABS(L_, 1); |
323 | Universe* const _U{ lua_tofulluserdata<Universe>(L_, 1) }; // L_: U | 323 | Universe* const _U{ lua_tofulluserdata<Universe>(L_, 1) }; // L_: U |
324 | _U->terminateFreeRunningLanes(L_, _shutdown_timeout, which_cancel_op(_op_string)); | 324 | _U->terminateFreeRunningLanes(L_, _shutdown_timeout, which_cancel_op(_op_string)); |