From a8df99e9276b2a4f4be3ffbcb34006e55861b551 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 24 Sep 2021 20:40:19 +0300 Subject: [PATCH] Use source_location::to_string in system_error::build_message --- include/boost/system/system_error.hpp | 28 ++------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/include/boost/system/system_error.hpp b/include/boost/system/system_error.hpp index 52008f5..fcc4f27 100644 --- a/include/boost/system/system_error.hpp +++ b/include/boost/system/system_error.hpp @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -26,14 +25,6 @@ private: private: - static std::string to_string( int v ) - { - char buffer[ 32 ]; - detail::snprintf( buffer, sizeof( buffer ), "%d", v ); - - return buffer; - } - static std::string build_message( char const * prefix, error_code const & ec ) { std::string r; @@ -51,23 +42,8 @@ private: r += " ["; r += ec.to_string(); r += " at "; - - boost::source_location loc = ec.location(); - - r += loc.file_name(); - - r += ':'; - r += to_string( loc.line() ); - - if( loc.column() != 0 ) - { - r += ':'; - r += to_string( loc.column() ); - } - - r += " in function '"; - r += loc.function_name(); - r += "\']"; + r += ec.location().to_string(); + r += "]"; } return r;