Remove extraneous function

This commit is contained in:
Vinnie Falco
2018-09-25 06:13:12 -07:00
parent 65022367bb
commit e2d192ec78
3 changed files with 15 additions and 16 deletions

View File

@@ -1,3 +1,9 @@
Version 184:
* Remove extraneous function
--------------------------------------------------------------------------------
Version 183: Version 183:
* Fix a rare case of failed UTF8 validation * Fix a rare case of failed UTF8 validation

View File

@@ -94,23 +94,15 @@ public:
} }
}; };
inline
error_category const&
get_http_error_category()
{
static http_error_category const cat{};
return cat;
}
} // detail } // detail
inline inline
error_code error_code
make_error_code(error ev) make_error_code(error ev)
{ {
return error_code{ static detail::http_error_category const cat{};
static_cast<std::underlying_type<error>::type>(ev), return error_code{static_cast<
detail::get_http_error_category()}; std::underlying_type<error>::type>(ev), cat};
} }
} // http } // http

View File

@@ -24,16 +24,17 @@ public:
check(char const* name, error ev) check(char const* name, error ev)
{ {
auto const ec = make_error_code(ev); auto const ec = make_error_code(ev);
auto const& cat =
make_error_code(static_cast<http::error>(0)).category();
BEAST_EXPECT(std::string(ec.category().name()) == name); BEAST_EXPECT(std::string(ec.category().name()) == name);
BEAST_EXPECT(! ec.message().empty()); BEAST_EXPECT(! ec.message().empty());
BEAST_EXPECT(std::addressof(ec.category()) == BEAST_EXPECT(std::addressof(ec.category()) == std::addressof(cat));
std::addressof(detail::get_http_error_category())); BEAST_EXPECT(cat.equivalent(
BEAST_EXPECT(detail::get_http_error_category().equivalent(
static_cast<std::underlying_type<error>::type>(ev), static_cast<std::underlying_type<error>::type>(ev),
ec.category().default_error_condition( ec.category().default_error_condition(
static_cast<std::underlying_type<error>::type>(ev)))); static_cast<std::underlying_type<error>::type>(ev))));
BEAST_EXPECT(detail::get_http_error_category().equivalent( BEAST_EXPECT(cat.equivalent(ec,
ec, static_cast<std::underlying_type<error>::type>(ev))); static_cast<std::underlying_type<error>::type>(ev)));
} }
void void