aboutsummaryrefslogtreecommitdiff
path: root/src/lanes.cpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-10-24 11:30:18 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-10-24 11:30:18 +0200
commiteba98e4e1adcf3ce11e5934e2dce54f29aef1e0a (patch)
treed51d51eb2d48208df1cfdf6eb0bd40a928d6243c /src/lanes.cpp
parent8745a54f88f31cd51dc86c96039ebe0b3e98f5ea (diff)
downloadlanes-eba98e4e1adcf3ce11e5934e2dce54f29aef1e0a.tar.gz
lanes-eba98e4e1adcf3ce11e5934e2dce54f29aef1e0a.tar.bz2
lanes-eba98e4e1adcf3ce11e5934e2dce54f29aef1e0a.zip
Make Unique even stronger
Diffstat (limited to 'src/lanes.cpp')
-rw-r--r--src/lanes.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp
index 572d8f9..e545ca0 100644
--- a/src/lanes.cpp
+++ b/src/lanes.cpp
@@ -329,7 +329,7 @@ LUAG_FUNC(lane_new)
329 DEBUGSPEW_CODE(DebugSpew(lane->U) << "lane_new: preparing lane userdata" << std::endl); 329 DEBUGSPEW_CODE(DebugSpew(lane->U) << "lane_new: preparing lane userdata" << std::endl);
330 STACK_CHECK_START_REL(L, 0); 330 STACK_CHECK_START_REL(L, 0);
331 // a Lane full userdata needs a single uservalue 331 // a Lane full userdata needs a single uservalue
332 Lane** const _ud{ luaG_newuserdatauv<Lane*>(L, 1) }; // L: ... lane 332 Lane** const _ud{ luaG_newuserdatauv<Lane*>(L, UserValueCount{ 1 }) }; // L: ... lane
333 *_ud = lane; // don't forget to store the pointer in the userdata! 333 *_ud = lane; // don't forget to store the pointer in the userdata!
334 334
335 // Set metatable for the userdata 335 // Set metatable for the userdata
@@ -342,7 +342,7 @@ LUAG_FUNC(lane_new)
342 lua_newtable(L); // L: ... lane {uv} 342 lua_newtable(L); // L: ... lane {uv}
343 343
344 // Store the gc_cb callback in the uservalue 344 // Store the gc_cb callback in the uservalue
345 StackIndex const _gc_cb_idx{ lua_isnoneornil(L, kGcCbIdx) ? 0 : kGcCbIdx }; 345 StackIndex const _gc_cb_idx{ lua_isnoneornil(L, kGcCbIdx) ? kIdxNone : kGcCbIdx };
346 if (_gc_cb_idx > 0) { 346 if (_gc_cb_idx > 0) {
347 kLaneGC.pushKey(L); // L: ... lane {uv} k 347 kLaneGC.pushKey(L); // L: ... lane {uv} k
348 lua_pushvalue(L, _gc_cb_idx); // L: ... lane {uv} k gc_cb 348 lua_pushvalue(L, _gc_cb_idx); // L: ... lane {uv} k gc_cb
@@ -354,7 +354,7 @@ LUAG_FUNC(lane_new)
354 354
355 lua_State* const _L2{ lane->L }; 355 lua_State* const _L2{ lane->L };
356 STACK_CHECK_START_REL(_L2, 0); 356 STACK_CHECK_START_REL(_L2, 0);
357 StackIndex const _name_idx{ lua_isnoneornil(L, kNameIdx) ? 0 : kNameIdx }; 357 StackIndex const _name_idx{ lua_isnoneornil(L, kNameIdx) ? kIdxNone : kNameIdx };
358 std::string_view const _debugName{ (_name_idx > 0) ? luaG_tostring(L, _name_idx) : std::string_view{} }; 358 std::string_view const _debugName{ (_name_idx > 0) ? luaG_tostring(L, _name_idx) : std::string_view{} };
359 if (!_debugName.empty()) 359 if (!_debugName.empty())
360 { 360 {
@@ -393,7 +393,7 @@ LUAG_FUNC(lane_new)
393 // On some platforms, -3 is equivalent to -2 and +3 to +2 393 // On some platforms, -3 is equivalent to -2 and +3 to +2
394 int const _priority{ 394 int const _priority{
395 std::invoke([L = L_]() { 395 std::invoke([L = L_]() {
396 int const _prio_idx{ lua_isnoneornil(L, kPrioIdx) ? 0 : kPrioIdx }; 396 StackIndex const _prio_idx{ lua_isnoneornil(L, kPrioIdx) ? kIdxNone : kPrioIdx };
397 if (_prio_idx == 0) { 397 if (_prio_idx == 0) {
398 return kThreadPrioDefault; 398 return kThreadPrioDefault;
399 } 399 }
@@ -412,7 +412,7 @@ LUAG_FUNC(lane_new)
412 STACK_CHECK_START_REL(L_, 0); 412 STACK_CHECK_START_REL(L_, 0);
413 413
414 // package 414 // package
415 StackIndex const _package_idx{ lua_isnoneornil(L_, kPackIdx) ? 0 : kPackIdx }; 415 StackIndex const _package_idx{ lua_isnoneornil(L_, kPackIdx) ? kIdxNone : kPackIdx };
416 if (_package_idx != 0) { 416 if (_package_idx != 0) {
417 DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: update 'package'" << std::endl); 417 DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: update 'package'" << std::endl);
418 // when copying with mode LookupMode::LaneBody, should raise an error in case of problem, not leave it one the stack 418 // when copying with mode LookupMode::LaneBody, should raise an error in case of problem, not leave it one the stack
@@ -424,7 +424,7 @@ LUAG_FUNC(lane_new)
424 STACK_CHECK(_L2, 0); 424 STACK_CHECK(_L2, 0);
425 425
426 // modules to require in the target lane *before* the function is transfered! 426 // modules to require in the target lane *before* the function is transfered!
427 StackIndex const _required_idx{ lua_isnoneornil(L_, kRequIdx) ? 0 : kRequIdx }; 427 StackIndex const _required_idx{ lua_isnoneornil(L_, kRequIdx) ? kIdxNone : kRequIdx };
428 if (_required_idx != 0) { 428 if (_required_idx != 0) {
429 int _nbRequired{ 1 }; 429 int _nbRequired{ 1 };
430 DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: process 'required' list" << std::endl); 430 DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: process 'required' list" << std::endl);
@@ -473,7 +473,7 @@ LUAG_FUNC(lane_new)
473 // Appending the specified globals to the global environment 473 // Appending the specified globals to the global environment
474 // *after* stdlibs have been loaded and modules required, in case we transfer references to native functions they exposed... 474 // *after* stdlibs have been loaded and modules required, in case we transfer references to native functions they exposed...
475 // 475 //
476 StackIndex const _globals_idx{ lua_isnoneornil(L_, kGlobIdx) ? 0 : kGlobIdx }; 476 StackIndex const _globals_idx{ lua_isnoneornil(L_, kGlobIdx) ? kIdxNone : kGlobIdx };
477 if (_globals_idx != 0) { 477 if (_globals_idx != 0) {
478 DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: transfer globals" << std::endl); 478 DEBUGSPEW_CODE(DebugSpew(_U) << "lane_new: transfer globals" << std::endl);
479 if (!lua_istable(L_, _globals_idx)) { 479 if (!lua_istable(L_, _globals_idx)) {