diff --git a/CHANGELOG.md b/CHANGELOG.md index 338289cb..d2c0eeb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Version 184: + +* Remove extraneous function + +-------------------------------------------------------------------------------- + Version 183: * Fix a rare case of failed UTF8 validation diff --git a/include/boost/beast/http/impl/error.ipp b/include/boost/beast/http/impl/error.ipp index 45075f5c..b6320cf4 100644 --- a/include/boost/beast/http/impl/error.ipp +++ b/include/boost/beast/http/impl/error.ipp @@ -94,23 +94,15 @@ public: } }; -inline -error_category const& -get_http_error_category() -{ - static http_error_category const cat{}; - return cat; -} - } // detail inline error_code make_error_code(error ev) { - return error_code{ - static_cast::type>(ev), - detail::get_http_error_category()}; + static detail::http_error_category const cat{}; + return error_code{static_cast< + std::underlying_type::type>(ev), cat}; } } // http diff --git a/test/beast/http/error.cpp b/test/beast/http/error.cpp index afd2b246..18abbf68 100644 --- a/test/beast/http/error.cpp +++ b/test/beast/http/error.cpp @@ -24,16 +24,17 @@ public: check(char const* name, error ev) { auto const ec = make_error_code(ev); + auto const& cat = + make_error_code(static_cast(0)).category(); BEAST_EXPECT(std::string(ec.category().name()) == name); BEAST_EXPECT(! ec.message().empty()); - BEAST_EXPECT(std::addressof(ec.category()) == - std::addressof(detail::get_http_error_category())); - BEAST_EXPECT(detail::get_http_error_category().equivalent( + BEAST_EXPECT(std::addressof(ec.category()) == std::addressof(cat)); + BEAST_EXPECT(cat.equivalent( static_cast::type>(ev), ec.category().default_error_condition( static_cast::type>(ev)))); - BEAST_EXPECT(detail::get_http_error_category().equivalent( - ec, static_cast::type>(ev))); + BEAST_EXPECT(cat.equivalent(ec, + static_cast::type>(ev))); } void