diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-09-11 13:02:47 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-04-11 22:19:46 +0200 |
commit | 9cc8e876e412056ed22d364538f0da3d5d71946d (patch) | |
tree | cf30bf1d489e1bd7a37274deedf06fe60fb175b4 /src/torcontrol.cpp | |
parent | 2b5a741e98f186e50d9fbe1ceadcc8b8c91547f7 (diff) |
refactor: introduce single-separator split helper `SplitString`
This helper uses spanparsing::Split internally and enables to replace
all calls to boost::split where only a single separator is passed.
Co-authored-by: Martin Ankerl <Martin.Ankerl@gmail.com>
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
Diffstat (limited to 'src/torcontrol.cpp')
-rw-r--r-- | src/torcontrol.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index a15094e5c8..6d7331f23a 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -24,9 +24,7 @@ #include <set> #include <vector> -#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/replace.hpp> -#include <boost/algorithm/string/split.hpp> #include <event2/buffer.h> #include <event2/bufferevent.h> @@ -347,8 +345,8 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe for (const auto& line : reply.lines) { if (0 == line.compare(0, 20, "net/listeners/socks=")) { const std::string port_list_str = line.substr(20); - std::vector<std::string> port_list; - boost::split(port_list, port_list_str, boost::is_any_of(" ")); + std::vector<std::string> port_list = SplitString(port_list_str, ' '); + for (auto& portstr : port_list) { if (portstr.empty()) continue; if ((portstr[0] == '"' || portstr[0] == '\'') && portstr.size() >= 2 && (*portstr.rbegin() == portstr[0])) { @@ -542,8 +540,10 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro if (l.first == "AUTH") { std::map<std::string,std::string> m = ParseTorReplyMapping(l.second); std::map<std::string,std::string>::iterator i; - if ((i = m.find("METHODS")) != m.end()) - boost::split(methods, i->second, boost::is_any_of(",")); + if ((i = m.find("METHODS")) != m.end()) { + std::vector<std::string> m_vec = SplitString(i->second, ','); + methods = std::set<std::string>(m_vec.begin(), m_vec.end()); + } if ((i = m.find("COOKIEFILE")) != m.end()) cookiefile = i->second; } else if (l.first == "VERSION") { |