aboutsummaryrefslogtreecommitdiff
path: root/src/macros_and_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/macros_and_utils.h')
-rw-r--r--src/macros_and_utils.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/macros_and_utils.h b/src/macros_and_utils.h
index aa81db4..5987e73 100644
--- a/src/macros_and_utils.h
+++ b/src/macros_and_utils.h
@@ -100,48 +100,48 @@ inline void LUA_ASSERT_IMPL(lua_State* L_, bool cond_, char const* file_, size_t
100class StackChecker 100class StackChecker
101{ 101{
102 private: 102 private:
103 lua_State* const m_L; 103 lua_State* const L;
104 int m_oldtop; 104 int oldtop;
105 105
106 public: 106 public:
107 struct Relative 107 struct Relative
108 { 108 {
109 int const m_offset; 109 int const offset;
110 110
111 operator int() const { return m_offset; } 111 operator int() const { return offset; }
112 }; 112 };
113 113
114 struct Absolute 114 struct Absolute
115 { 115 {
116 int const m_offset; 116 int const offset;
117 117
118 operator int() const { return m_offset; } 118 operator int() const { return offset; }
119 }; 119 };
120 120
121 StackChecker(lua_State* const L_, Relative offset_, char const* file_, size_t const line_) 121 StackChecker(lua_State* const L_, Relative offset_, char const* file_, size_t const line_)
122 : m_L{ L_ } 122 : L{ L_ }
123 , m_oldtop{ lua_gettop(L_) - offset_ } 123 , oldtop{ lua_gettop(L_) - offset_ }
124 { 124 {
125 if ((offset_ < 0) || (m_oldtop < 0)) { 125 if ((offset_ < 0) || (oldtop < 0)) {
126 assert(false); 126 assert(false);
127 raise_luaL_error(m_L, "STACK INIT ASSERT failed (%d not %d): %s:%llu", lua_gettop(m_L), offset_, file_, line_); 127 raise_luaL_error(L, "STACK INIT ASSERT failed (%d not %d): %s:%llu", lua_gettop(L), offset_, file_, line_);
128 } 128 }
129 } 129 }
130 130
131 StackChecker(lua_State* const L_, Absolute pos_, char const* file_, size_t const line_) 131 StackChecker(lua_State* const L_, Absolute pos_, char const* file_, size_t const line_)
132 : m_L{ L_ } 132 : L{ L_ }
133 , m_oldtop{ 0 } 133 , oldtop{ 0 }
134 { 134 {
135 if (lua_gettop(m_L) != pos_) { 135 if (lua_gettop(L) != pos_) {
136 assert(false); 136 assert(false);
137 raise_luaL_error(m_L, "STACK INIT ASSERT failed (%d not %d): %s:%llu", lua_gettop(m_L), pos_, file_, line_); 137 raise_luaL_error(L, "STACK INIT ASSERT failed (%d not %d): %s:%llu", lua_gettop(L), pos_, file_, line_);
138 } 138 }
139 } 139 }
140 140
141 StackChecker& operator=(StackChecker const& rhs_) 141 StackChecker& operator=(StackChecker const& rhs_)
142 { 142 {
143 assert(m_L == rhs_.m_L); 143 assert(L == rhs_.L);
144 m_oldtop = rhs_.m_oldtop; 144 oldtop = rhs_.oldtop;
145 return *this; 145 return *this;
146 } 146 }
147 147
@@ -149,10 +149,10 @@ class StackChecker
149 void check(int expected_, char const* file_, size_t const line_) 149 void check(int expected_, char const* file_, size_t const line_)
150 { 150 {
151 if (expected_ != LUA_MULTRET) { 151 if (expected_ != LUA_MULTRET) {
152 int const actual{ lua_gettop(m_L) - m_oldtop }; 152 int const actual{ lua_gettop(L) - oldtop };
153 if (actual != expected_) { 153 if (actual != expected_) {
154 assert(false); 154 assert(false);
155 raise_luaL_error(m_L, "STACK ASSERT failed (%d not %d): %s:%llu", actual, expected_, file_, line_); 155 raise_luaL_error(L, "STACK ASSERT failed (%d not %d): %s:%llu", actual, expected_, file_, line_);
156 } 156 }
157 } 157 }
158 } 158 }
@@ -233,13 +233,13 @@ template <typename T, auto = [] {}, typename specialization = void>
233class Unique 233class Unique
234{ 234{
235 private: 235 private:
236 T m_val; 236 T val;
237 237
238 public: 238 public:
239 Unique() = default; 239 Unique() = default;
240 operator T() const { return m_val; } 240 operator T() const { return val; }
241 explicit Unique(T b_) 241 explicit Unique(T b_)
242 : m_val{ b_ } 242 : val{ b_ }
243 { 243 {
244 } 244 }
245}; 245};