1
0
Fork 0

Codechange: use std::string_view over char*

pull/10063/merge
Rubidium 2025-05-01 16:54:17 +02:00 committed by rubidium42
parent f2a32c6d13
commit c420ba349d
3 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@
FatalError("NOT_REACHED triggered at line {} of {}", location.line(), location.file_name()); 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); FatalError("Assertion failed at line {} of {}: {}", location.line(), location.file_name(), expression);
} }

View File

@ -260,7 +260,7 @@ static const uint MAX_FRAMES = 64;
} }
/* Get module name. */ /* Get module name. */
const char *mod_name = "???"; std::string_view mod_name = "???";
IMAGEHLP_MODULE64 module; IMAGEHLP_MODULE64 module;
module.SizeOfStruct = sizeof(module); module.SizeOfStruct = sizeof(module);
@ -269,7 +269,7 @@ static const uint MAX_FRAMES = 64;
} }
/* Print module and instruction pointer. */ /* 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. */ /* Get symbol name and line info if possible. */
DWORD64 offset; DWORD64 offset;

View File

@ -295,7 +295,7 @@ char (&ArraySizeHelper(T (&array)[N]))[N];
#endif /* __GNUC__ || __clang__ */ #endif /* __GNUC__ || __clang__ */
[[noreturn]] void NOT_REACHED(const std::source_location location = std::source_location::current()); [[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. */ /* For non-debug builds with assertions enabled use the special assertion handler. */
#if defined(NDEBUG) && defined(WITH_ASSERT) #if defined(NDEBUG) && defined(WITH_ASSERT)