aboutsummaryrefslogtreecommitdiff
path: root/src/macros_and_utils.h
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-06-06 17:20:12 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-06-06 17:20:12 +0200
commitd9a149a230f9b320113020789beb78a883da3b40 (patch)
tree64925d938067e97b76d142cf915a5e1ce840246f /src/macros_and_utils.h
parent5fcbc757f62cdc9698a8f783864141f40fdff34e (diff)
downloadlanes-d9a149a230f9b320113020789beb78a883da3b40.tar.gz
lanes-d9a149a230f9b320113020789beb78a883da3b40.tar.bz2
lanes-d9a149a230f9b320113020789beb78a883da3b40.zip
Converted a few more raw string pointers to std::string_view
Diffstat (limited to 'src/macros_and_utils.h')
-rw-r--r--src/macros_and_utils.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/macros_and_utils.h b/src/macros_and_utils.h
index 7bb0d2a..926e756 100644
--- a/src/macros_and_utils.h
+++ b/src/macros_and_utils.h
@@ -21,7 +21,7 @@ using namespace std::chrono_literals;
21// ################################################################################################# 21// #################################################################################################
22 22
23// use this instead of Lua's lua_error 23// use this instead of Lua's lua_error
24[[noreturn]] static inline void raise_lua_error(lua_State* L_) 24[[noreturn]] static inline void raise_lua_error(lua_State* const L_)
25{ 25{
26 std::ignore = lua_error(L_); // doesn't return 26 std::ignore = lua_error(L_); // doesn't return
27 assert(false); // we should never get here, but i'm paranoid 27 assert(false); // we should never get here, but i'm paranoid
@@ -31,9 +31,9 @@ using namespace std::chrono_literals;
31 31
32// use this instead of Lua's luaL_error 32// use this instead of Lua's luaL_error
33template <typename... ARGS> 33template <typename... ARGS>
34[[noreturn]] static inline void raise_luaL_error(lua_State* L_, char const* fmt_, ARGS... args_) 34[[noreturn]] static inline void raise_luaL_error(lua_State* const L_, std::string_view const& fmt_, ARGS... args_)
35{ 35{
36 std::ignore = luaL_error(L_, fmt_, std::forward<ARGS>(args_)...); // doesn't return 36 std::ignore = luaL_error(L_, fmt_.data(), std::forward<ARGS>(args_)...); // doesn't return
37 assert(false); // we should never get here, but i'm paranoid 37 assert(false); // we should never get here, but i'm paranoid
38} 38}
39 39
@@ -41,9 +41,9 @@ template <typename... ARGS>
41 41
42// use this instead of Lua's luaL_argerror 42// use this instead of Lua's luaL_argerror
43template <typename... ARGS> 43template <typename... ARGS>
44[[noreturn]] static inline void raise_luaL_argerror(lua_State* L_, int arg_, char const* extramsg_) 44[[noreturn]] static inline void raise_luaL_argerror(lua_State* const L_, int const arg_, std::string_view const& extramsg_)
45{ 45{
46 std::ignore = luaL_argerror(L_, arg_, extramsg_); // doesn't return 46 std::ignore = luaL_argerror(L_, arg_, extramsg_.data()); // doesn't return
47 assert(false); // we should never get here, but i'm paranoid 47 assert(false); // we should never get here, but i'm paranoid
48} 48}
49 49
@@ -52,9 +52,9 @@ template <typename... ARGS>
52#if LUA_VERSION_NUM >= 504 52#if LUA_VERSION_NUM >= 504
53// use this instead of Lua's luaL_typeerror 53// use this instead of Lua's luaL_typeerror
54template <typename... ARGS> 54template <typename... ARGS>
55[[noreturn]] static inline void raise_luaL_typeerror(lua_State* L_, int arg_, char const* tname_) 55[[noreturn]] static inline void raise_luaL_typeerror(lua_State* const L_, int const arg_, std::string_view const& tname_)
56{ 56{
57 std::ignore = luaL_typeerror(L_, arg_, tname_); // doesn't return 57 std::ignore = luaL_typeerror(L_, arg_, tname_.data()); // doesn't return
58 assert(false); // we should never get here, but i'm paranoid 58 assert(false); // we should never get here, but i'm paranoid
59} 59}
60#endif // LUA_VERSION_NUM 60#endif // LUA_VERSION_NUM