Remove unnecessary constant_time_size for multi_buffer:

http::basic_fields::set_t::size() is unused
core::multi_buffer::list_type::size() is only compared to 1 (in shrink_to_fit()); compare iterators instead.

close #2498
This commit is contained in:
Ed Catmur
2022-08-17 18:58:08 +01:00
committed by Richard Hodges
parent 177855b4bc
commit 78fc61a9f7
4 changed files with 7 additions and 5 deletions

View File

@ -1,3 +1,4 @@
* Reduce size of multi_buffer.
* Upgrade OS on some drone CI jobs.
--------------------------------------------------------------------------------

View File

@ -779,7 +779,7 @@ shrink_to_fit()
};
// partial last buffer
if(list_.size() > 1 && out_ != list_.end())
if(out_ != list_.begin() && out_ != list_.end())
{
BOOST_ASSERT(out_ ==
list_.iterator_to(list_.back()));
@ -815,7 +815,8 @@ shrink_to_fit()
}
else
{
BOOST_ASSERT(list_.size() == 1);
BOOST_ASSERT(out_ ==
list_.iterator_to(list_.back()));
BOOST_ASSERT(out_pos_ > in_pos_);
auto const n = out_pos_ - in_pos_;
auto& e = alloc(n);

View File

@ -127,7 +127,7 @@ class basic_multi_buffer
beast::detail::allocator_traits<rebind_type>;
using list_type = typename boost::intrusive::make_list<
element, boost::intrusive::constant_time_size<true>>::type;
element, boost::intrusive::constant_time_size<false>>::type;
using iter = typename list_type::iterator;
@ -591,4 +591,4 @@ using multi_buffer = basic_multi_buffer<std::allocator<char>>;
#include <boost/beast/core/impl/multi_buffer.hpp>
#endif
#endif

View File

@ -190,7 +190,7 @@ private:
using set_t = typename boost::intrusive::make_multiset<
element,
boost::intrusive::constant_time_size<true>,
boost::intrusive::constant_time_size<false>,
boost::intrusive::compare<key_compare>
>::type;