aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/allocator.h8
-rw-r--r--src/cancel.cpp6
-rw-r--r--src/lane.cpp4
3 files changed, 10 insertions, 8 deletions
diff --git a/src/allocator.h b/src/allocator.h
index e0ff9d6..3f8ccc5 100644
--- a/src/allocator.h
+++ b/src/allocator.h
@@ -28,23 +28,25 @@ namespace lanes {
28 , allocUD{ allocUD_ } 28 , allocUD{ allocUD_ }
29 { 29 {
30 } 30 }
31
32 // rule of 5
31 AllocatorDefinition() = default; 33 AllocatorDefinition() = default;
32 AllocatorDefinition(AllocatorDefinition const& rhs_) = default; 34 AllocatorDefinition(AllocatorDefinition const& rhs_) = default;
33 AllocatorDefinition(AllocatorDefinition&& rhs_) = default; 35 AllocatorDefinition(AllocatorDefinition&& rhs_) = default;
34 AllocatorDefinition& operator=(AllocatorDefinition const& rhs_) = default; 36 AllocatorDefinition& operator=(AllocatorDefinition const& rhs_) = default;
35 AllocatorDefinition& operator=(AllocatorDefinition&& rhs_) = default; 37 AllocatorDefinition& operator=(AllocatorDefinition&& rhs_) = default;
36 38
37 void initFrom(lua_State* L_) 39 void initFrom(lua_State* const L_)
38 { 40 {
39 allocF = lua_getallocf(L_, &allocUD); 41 allocF = lua_getallocf(L_, &allocUD);
40 } 42 }
41 43
42 void* alloc(size_t nsize_) 44 void* alloc(size_t const nsize_)
43 { 45 {
44 return allocF(allocUD, nullptr, 0, nsize_); 46 return allocF(allocUD, nullptr, 0, nsize_);
45 } 47 }
46 48
47 void free(void* ptr_, size_t osize_) 49 void free(void* const ptr_, size_t const osize_)
48 { 50 {
49 std::ignore = allocF(allocUD, ptr_, osize_, 0); 51 std::ignore = allocF(allocUD, ptr_, osize_, 0);
50 } 52 }
diff --git a/src/cancel.cpp b/src/cancel.cpp
index 2d0b807..46ed347 100644
--- a/src/cancel.cpp
+++ b/src/cancel.cpp
@@ -52,7 +52,7 @@ THE SOFTWARE.
52 */ 52 */
53[[nodiscard]] CancelRequest CheckCancelRequest(lua_State* const L_) 53[[nodiscard]] CancelRequest CheckCancelRequest(lua_State* const L_)
54{ 54{
55 Lane* const _lane{ kLanePointerRegKey.readLightUserDataValue<Lane>(L_) }; 55 auto const* const _lane{ kLanePointerRegKey.readLightUserDataValue<Lane>(L_) };
56 // 'lane' is nullptr for the original main state (and no-one can cancel that) 56 // 'lane' is nullptr for the original main state (and no-one can cancel that)
57 return _lane ? _lane->cancelRequest : CancelRequest::None; 57 return _lane ? _lane->cancelRequest : CancelRequest::None;
58} 58}
@@ -82,7 +82,7 @@ THE SOFTWARE.
82 82
83CancelOp WhichCancelOp(std::string_view const& opString_) 83CancelOp WhichCancelOp(std::string_view const& opString_)
84{ 84{
85 CancelOp _op{ CancelOp::Invalid }; 85 auto _op{ CancelOp::Invalid };
86 if (opString_ == "hard") { 86 if (opString_ == "hard") {
87 _op = CancelOp::Hard; 87 _op = CancelOp::Hard;
88 } else if (opString_ == "soft") { 88 } else if (opString_ == "soft") {
@@ -110,7 +110,7 @@ CancelOp WhichCancelOp(std::string_view const& opString_)
110 CancelOp _op{ WhichCancelOp(_str) }; 110 CancelOp _op{ WhichCancelOp(_str) };
111 lua_remove(L_, idx_); // argument is processed, remove it 111 lua_remove(L_, idx_); // argument is processed, remove it
112 if (_op == CancelOp::Invalid) { 112 if (_op == CancelOp::Invalid) {
113 raise_luaL_error(L_, "invalid hook option %s", _str); 113 raise_luaL_error(L_, "invalid hook option %s", _str.data());
114 } 114 }
115 return _op; 115 return _op;
116 } 116 }
diff --git a/src/lane.cpp b/src/lane.cpp
index 9f68c91..6e6130c 100644
--- a/src/lane.cpp
+++ b/src/lane.cpp
@@ -1018,7 +1018,7 @@ namespace {
1018} // namespace 1018} // namespace
1019 1019
1020 // contains keys: { __close, __gc, __index, kCachedError, kCachedTostring, cancel, get_threadname, join } 1020 // contains keys: { __close, __gc, __index, kCachedError, kCachedTostring, cancel, get_threadname, join }
1021void Lane::PushMetatable(lua_State* L_) 1021void Lane::PushMetatable(lua_State* const L_)
1022{ 1022{
1023 STACK_CHECK_START_REL(L_, 0); 1023 STACK_CHECK_START_REL(L_, 0);
1024 if (luaL_newmetatable(L_, kLaneMetatableName.data())) { // L_: mt 1024 if (luaL_newmetatable(L_, kLaneMetatableName.data())) { // L_: mt
@@ -1039,7 +1039,7 @@ void Lane::PushMetatable(lua_State* L_)
1039 1039
1040// ################################################################################################# 1040// #################################################################################################
1041 1041
1042void Lane::pushStatusString(lua_State* L_) const 1042void Lane::pushStatusString(lua_State* const L_) const
1043{ 1043{
1044 std::string_view const _str{ threadStatusString() }; 1044 std::string_view const _str{ threadStatusString() };
1045 LUA_ASSERT(L_, !_str.empty()); 1045 LUA_ASSERT(L_, !_str.empty());