From ec8574d298ef302bc4162d9b394e96bf08763632 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Fri, 14 Jun 2024 17:01:53 +0200 Subject: Boyscouting --- src/cancel.cpp | 2 +- src/lane.cpp | 8 ++++---- src/lane.h | 2 +- src/tracker.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cancel.cpp b/src/cancel.cpp index a62fa96..990f5d4 100644 --- a/src/cancel.cpp +++ b/src/cancel.cpp @@ -186,7 +186,7 @@ LUAG_FUNC(thread_cancel) case CancelResult::Cancelled: lua_pushboolean(L_, 1); // true - std::ignore = _lane->pushThreadStatus(L_); // true "" + _lane->pushStatusString(L_); // true "" break; } STACK_CHECK(L_, 2); diff --git a/src/lane.cpp b/src/lane.cpp index a998e9c..e801cba 100644 --- a/src/lane.cpp +++ b/src/lane.cpp @@ -228,7 +228,7 @@ static int thread_index_number(lua_State* L_) // this is an internal error, we probably never get here lua_settop(L_, 0); // L_: luaG_pushstring(L_, "Unexpected status: "); // L_: "Unexpected status: " - std::ignore = _lane->pushThreadStatus(L_); // L_: "Unexpected status: " "" + _lane->pushStatusString(L_); // L_: "Unexpected status: " "" lua_concat(L_, 2); // L_: "Unexpected status: " raise_lua_error(L_); @@ -315,7 +315,7 @@ static int thread_index_string(lua_State* L_) std::string_view const _keystr{ luaG_tostring(L_, kKey) }; lua_settop(L_, 2); // keep only our original arguments on the stack if (_keystr == "status") { - std::ignore = _lane->pushThreadStatus(L_); // L_: lane "key" "" + _lane->pushStatusString(L_); // L_: lane "key" "" return 1; } if (_keystr == "error_trace_level") { @@ -1008,12 +1008,12 @@ void Lane::PushMetatable(lua_State* L_) // ################################################################################################# -[[nodiscard]] std::string_view Lane::pushThreadStatus(lua_State* L_) const +void Lane::pushStatusString(lua_State* L_) const { std::string_view const _str{ threadStatusString() }; LUA_ASSERT(L_, !_str.empty()); - return luaG_pushstring(L_, _str); + luaG_pushstring(L_, _str); } // ################################################################################################# diff --git a/src/lane.h b/src/lane.h index 704a760..4461b37 100644 --- a/src/lane.h +++ b/src/lane.h @@ -138,7 +138,7 @@ class Lane [[nodiscard]] int pushErrorHandler() const; [[nodiscard]] std::string_view pushErrorTraceLevel(lua_State* L_) const; static void PushMetatable(lua_State* L_); - [[nodiscard]] std::string_view pushThreadStatus(lua_State* L_) const; + void pushStatusString(lua_State* L_) const; void securizeDebugName(lua_State* L_); void startThread(int priority_); [[nodiscard]] std::string_view threadStatusString() const; diff --git a/src/tracker.cpp b/src/tracker.cpp index 315b56b..05902c9 100644 --- a/src/tracker.cpp +++ b/src/tracker.cpp @@ -96,7 +96,7 @@ void LaneTracker::tracking_add(Lane* lane_) lua_createtable(L_, 0, 2); // L_: {} {} luaG_pushstring(L_, _lane->debugName); // L_: {} {} "name" lua_setfield(L_, -2, "name"); // L_: {} {} - std::ignore = _lane->pushThreadStatus(L_); // L_: {} {} "status" + _lane->pushStatusString(L_); // L_: {} {} "" lua_setfield(L_, -2, "status"); // L_: {} {} lua_rawseti(L_, -2, ++_index); // L_: {} _lane = _lane->tracking_next; -- cgit v1.2.3-55-g6feb