aboutsummaryrefslogtreecommitdiff
path: root/src/universe.cpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-11-20 18:03:33 +0100
committerBenoit Germain <benoit.germain@ubisoft.com>2024-11-20 18:03:33 +0100
commit0f6f3c207c46fa28059403e5f16af774d20c7ea2 (patch)
tree8031145bb2534c33ca0f2c65b9de85696c8a8ee0 /src/universe.cpp
parent304e4dfabe4555dff4aa72e75b677405fd30d1b3 (diff)
downloadlanes-0f6f3c207c46fa28059403e5f16af774d20c7ea2.tar.gz
lanes-0f6f3c207c46fa28059403e5f16af774d20c7ea2.tar.bz2
lanes-0f6f3c207c46fa28059403e5f16af774d20c7ea2.zip
More [[nodiscard]] boyscouting
Diffstat (limited to 'src/universe.cpp')
-rw-r--r--src/universe.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/universe.cpp b/src/universe.cpp
index 283747f..eab5977 100644
--- a/src/universe.cpp
+++ b/src/universe.cpp
@@ -119,7 +119,8 @@ void Universe::callOnStateCreate(lua_State* const L_, lua_State* const from_, Lo
119// ################################################################################################# 119// #################################################################################################
120 120
121// only called from the master state 121// only called from the master state
122[[nodiscard]] Universe* Universe::Create(lua_State* const L_) 122[[nodiscard]]
123Universe* Universe::Create(lua_State* const L_)
123{ 124{
124 LUA_ASSERT(L_, Universe::Get(L_) == nullptr); 125 LUA_ASSERT(L_, Universe::Get(L_) == nullptr);
125 static constexpr StackIndex kIdxSettings{ 1 }; 126 static constexpr StackIndex kIdxSettings{ 1 };
@@ -194,7 +195,8 @@ void Universe::callOnStateCreate(lua_State* const L_, lua_State* const from_, Lo
194// ################################################################################################# 195// #################################################################################################
195 196
196// same as PUC-Lua l_alloc 197// same as PUC-Lua l_alloc
197[[nodiscard]] static void* libc_lua_Alloc([[maybe_unused]] void* ud_, [[maybe_unused]] void* ptr_, [[maybe_unused]] size_t osize_, size_t nsize_) 198[[nodiscard]]
199static void* libc_lua_Alloc([[maybe_unused]] void* ud_, [[maybe_unused]] void* ptr_, [[maybe_unused]] size_t osize_, size_t nsize_)
198{ 200{
199 if (nsize_ == 0) { 201 if (nsize_ == 0) {
200 free(ptr_); 202 free(ptr_);
@@ -206,7 +208,8 @@ void Universe::callOnStateCreate(lua_State* const L_, lua_State* const from_, Lo
206 208
207// ################################################################################################# 209// #################################################################################################
208 210
209[[nodiscard]] static int luaG_provide_protected_allocator(lua_State* const L_) 211[[nodiscard]]
212static int luaG_provide_protected_allocator(lua_State* const L_)
210{ 213{
211 Universe* const _U{ Universe::Get(L_) }; 214 Universe* const _U{ Universe::Get(L_) };
212 // push a new full userdata on the stack, giving access to the universe's protected allocator 215 // push a new full userdata on the stack, giving access to the universe's protected allocator