mirror of https://github.com/OpenTTD/OpenTTD
Codechange: use std::string_view over char*
parent
f2a32c6d13
commit
c420ba349d
|
@ -16,7 +16,7 @@
|
|||
FatalError("NOT_REACHED triggered at line {} of {}", location.line(), location.file_name());
|
||||
}
|
||||
|
||||
[[noreturn]] void AssertFailedError(const char *expression, const std::source_location location)
|
||||
[[noreturn]] void AssertFailedError(std::string_view expression, const std::source_location location)
|
||||
{
|
||||
FatalError("Assertion failed at line {} of {}: {}", location.line(), location.file_name(), expression);
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ static const uint MAX_FRAMES = 64;
|
|||
}
|
||||
|
||||
/* Get module name. */
|
||||
const char *mod_name = "???";
|
||||
std::string_view mod_name = "???";
|
||||
|
||||
IMAGEHLP_MODULE64 module;
|
||||
module.SizeOfStruct = sizeof(module);
|
||||
|
@ -269,7 +269,7 @@ static const uint MAX_FRAMES = 64;
|
|||
}
|
||||
|
||||
/* Print module and instruction pointer. */
|
||||
std::string message = fmt::format("{:20s} {:X}", mod_name, frame.AddrPC.Offset);
|
||||
std::string message = fmt::format("{:20s} {:X}", mod_name, frame.AddrPC.Offset);
|
||||
|
||||
/* Get symbol name and line info if possible. */
|
||||
DWORD64 offset;
|
||||
|
|
|
@ -295,7 +295,7 @@ char (&ArraySizeHelper(T (&array)[N]))[N];
|
|||
#endif /* __GNUC__ || __clang__ */
|
||||
|
||||
[[noreturn]] void NOT_REACHED(const std::source_location location = std::source_location::current());
|
||||
[[noreturn]] void AssertFailedError(const char *expression, const std::source_location location = std::source_location::current());
|
||||
[[noreturn]] void AssertFailedError(std::string_view expression, const std::source_location location = std::source_location::current());
|
||||
|
||||
/* For non-debug builds with assertions enabled use the special assertion handler. */
|
||||
#if defined(NDEBUG) && defined(WITH_ASSERT)
|
||||
|
|
Loading…
Reference in New Issue