From dc7d7bc45d9b6cb3a052d69fbdacbd33b9ff3796 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 5 Jun 2026 15:45:24 +0200 Subject: upgrade to std::format --- src/post_mortem.cpp | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'src/post_mortem.cpp') diff --git a/src/post_mortem.cpp b/src/post_mortem.cpp index 01f180a..2db7ee9 100644 --- a/src/post_mortem.cpp +++ b/src/post_mortem.cpp @@ -6,8 +6,8 @@ #include #include +#include #include -#include #include #include #include @@ -16,42 +16,33 @@ namespace winapi { namespace { std::string pdb_already_loaded(Address online_base, const std::string& path) { - std::ostringstream oss; - oss << "module with online base address " << address::format(online_base) - << " has already been loaded: " << path; - return oss.str(); + return std::format("module with online base address {} has already been loaded: {}", + address::format(online_base), + path); } std::string pdb_already_loaded(const std::string& path) { - std::ostringstream oss; - oss << "module has already been loaded: " << path; - return oss.str(); + return std::format("module has already been loaded: {}", path); } std::string offline_base_already_used(Address base) { - std::ostringstream oss; - oss << "module with offline base address " << address::format(base) - << " has already been loaded (shouldn't happen)"; - return oss.str(); + return std::format( + "module with offline base address {} has already been loaded (shouldn't happen)", + address::format(base)); } std::string module_not_found(Address base) { - std::ostringstream oss; - oss << "module with base address " << address::format(base) << " wasn't found"; - return oss.str(); + return std::format("module with base address {} wasn't found", address::format(base)); } std::string guess_module_no_modules(Address pivot) { - std::ostringstream oss; - oss << "couldn't select a module for address " << address::format(pivot) - << ": no modules have been loaded yet"; - return oss.str(); + return std::format("couldn't select a module for address {}: no modules have been loaded yet", + address::format(pivot)); } std::string guess_module_address_too_low(Address pivot) { - std::ostringstream oss; - oss << "couldn't select a module for address " << address::format(pivot) << ": it's too low"; - return oss.str(); + return std::format("couldn't select a module for address {}: it's too low", + address::format(pivot)); } template -- cgit v1.3