aboutsummaryrefslogtreecommitdiff
path: root/src/netaddress.cpp
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2020-08-31 10:39:00 +0200
committerVasil Dimov <vd@FreeBSD.org>2020-09-11 13:35:39 +0200
commitd2bb681f96fb327b4c4d5b2b113692ca22fdffbf (patch)
tree21e9dd765e4d7d389f55cc0b5c6fca7ddce2ff2d /src/netaddress.cpp
parenta47e5964861dfb98d61719c9852e12fd6da84c31 (diff)
util: move HasPrefix() so it can be reused
Move the function `HasPrefix()` from `netaddress.cpp` to `util/string.h` so it can be reused by `CNetAddr` methods (and possibly others).
Diffstat (limited to 'src/netaddress.cpp')
-rw-r--r--src/netaddress.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp
index b50cf74069..86fca451f0 100644
--- a/src/netaddress.cpp
+++ b/src/netaddress.cpp
@@ -7,8 +7,9 @@
#include <hash.h>
#include <tinyformat.h>
-#include <util/strencodings.h>
#include <util/asmap.h>
+#include <util/strencodings.h>
+#include <util/string.h>
#include <algorithm>
#include <array>
@@ -50,13 +51,6 @@ void CNetAddr::SetIP(const CNetAddr& ipIn)
m_addr = ipIn.m_addr;
}
-template <typename T1, size_t PREFIX_LEN>
-inline bool HasPrefix(const T1& obj, const std::array<uint8_t, PREFIX_LEN>& prefix)
-{
- return obj.size() >= PREFIX_LEN &&
- std::equal(std::begin(prefix), std::end(prefix), std::begin(obj));
-}
-
void CNetAddr::SetLegacyIPv6(Span<const uint8_t> ipv6)
{
assert(ipv6.size() == ADDR_IPV6_SIZE);