From a7b2026ef8f55bab8aa0a4f47e47fb7bfe005c35 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Mon, 14 May 2018 11:01:43 -0400 Subject: [PATCH] minor code refactor in ip_filter code --- include/libtorrent/ip_filter.hpp | 4 ++-- src/ip_filter.cpp | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/include/libtorrent/ip_filter.hpp b/include/libtorrent/ip_filter.hpp index e821e3257..3f254f6c1 100644 --- a/include/libtorrent/ip_filter.hpp +++ b/include/libtorrent/ip_filter.hpp @@ -125,7 +125,7 @@ namespace detail { Addr tmp; std::fill(tmp.begin(), tmp.end() , (std::numeric_limits::max)()); - return Addr(tmp); + return tmp; } template<> @@ -288,7 +288,7 @@ struct TORRENT_EXPORT ip_filter // // This means that in a case of overlapping ranges, the last one applied takes // precedence. - void add_rule(address first, address last, std::uint32_t flags); + void add_rule(address const& first, address const& last, std::uint32_t flags); // Returns the access permissions for the given address (``addr``). The permission // can currently be 0 or ``ip_filter::blocked``. The complexity of this operation diff --git a/src/ip_filter.cpp b/src/ip_filter.cpp index 466e68563..8b50f23f9 100644 --- a/src/ip_filter.cpp +++ b/src/ip_filter.cpp @@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { - void ip_filter::add_rule(address first, address last, std::uint32_t flags) + void ip_filter::add_rule(address const& first, address const& last, std::uint32_t flags) { if (first.is_v4()) { @@ -83,13 +83,4 @@ namespace libtorrent { { return m_filter.access(port); } -/* - void ip_filter::print() const - { - for (range_t::iterator i = m_access_list.begin(); i != m_access_list.end(); ++i) - { - std::cout << i->start.as_string() << " " << i->access << "\n"; - } - } -*/ }