Use source_location::to_string in system_error::build_message

This commit is contained in:
Peter Dimov
2021-09-24 20:40:19 +03:00
parent d2b8b54356
commit a8df99e927

View File

@ -8,7 +8,6 @@
#include <boost/system/errc.hpp>
#include <boost/system/detail/error_code.hpp>
#include <boost/system/detail/snprintf.hpp>
#include <string>
#include <stdexcept>
#include <cassert>
@ -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;