core_read: Replace boost::split with SplitString

Note that `SplitString` doesn't support token compression, but in this case
it does not matter as empty strings are already skipped anyways.

Also removes split.hpp and classification.hpp from expected includes
24.x
Martin Leitner-Ankerl 3 years ago
parent b7ab9db545
commit 0d7efcdf75
No known key found for this signature in database
GPG Key ID: FBEAAD7FC6FFFE81

@ -14,9 +14,6 @@
#include <util/strencodings.h> #include <util/strencodings.h>
#include <version.h> #include <version.h>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <algorithm> #include <algorithm>
#include <string> #include <string>
@ -66,12 +63,11 @@ CScript ParseScript(const std::string& s)
{ {
CScript result; CScript result;
std::vector<std::string> words; std::vector<std::string> words = SplitString(s, " \t\n");
boost::algorithm::split(words, s, boost::algorithm::is_any_of(" \t\n"), boost::algorithm::token_compress_on);
for (const std::string& w : words) { for (const std::string& w : words) {
if (w.empty()) { if (w.empty()) {
// Empty string, ignore. (boost::split given '' will return one word) // Empty string, ignore. (SplitString doesn't combine multiple separators)
} else if (std::all_of(w.begin(), w.end(), ::IsDigit) || } else if (std::all_of(w.begin(), w.end(), ::IsDigit) ||
(w.front() == '-' && w.size() > 1 && std::all_of(w.begin() + 1, w.end(), ::IsDigit))) (w.front() == '-' && w.size() > 1 && std::all_of(w.begin() + 1, w.end(), ::IsDigit)))
{ {

@ -22,9 +22,7 @@ EXCLUDED_DIRS = ["src/leveldb/",
"src/univalue/"] "src/univalue/"]
EXPECTED_BOOST_INCLUDES = ["boost/algorithm/string.hpp", EXPECTED_BOOST_INCLUDES = ["boost/algorithm/string.hpp",
"boost/algorithm/string/classification.hpp",
"boost/algorithm/string/replace.hpp", "boost/algorithm/string/replace.hpp",
"boost/algorithm/string/split.hpp",
"boost/date_time/posix_time/posix_time.hpp", "boost/date_time/posix_time/posix_time.hpp",
"boost/multi_index/hashed_index.hpp", "boost/multi_index/hashed_index.hpp",
"boost/multi_index/ordered_index.hpp", "boost/multi_index/ordered_index.hpp",

Loading…
Cancel
Save