Removes the boost/algorithm/string/join dependency

This commit removes the `boost/algorithm/string/join` dependency
from the project by replacing `boost::algorithm::join` with
a simple helper function.
This commit is contained in:
251 2018-07-20 23:48:26 +02:00
parent 2dc5ab6378
commit 5f019d5354
2 changed files with 11 additions and 6 deletions

View file

@ -45,7 +45,6 @@
#include <sstream> #include <sstream>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#if defined(NDEBUG) #if defined(NDEBUG)
@ -2242,6 +2241,13 @@ static void DoWarning(const std::string& strWarning)
} }
} }
/** Private helper function that concatenates warning messages. */
static void AppendWarning(std::string& res, const std::string& warn)
{
if (!res.empty()) res += ", ";
res += warn;
}
/** Check warning conditions and do some notifications on new chain tip set. */ /** Check warning conditions and do some notifications on new chain tip set. */
void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainParams) { void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainParams) {
// New best block // New best block
@ -2253,7 +2259,7 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
g_best_block_cv.notify_all(); g_best_block_cv.notify_all();
} }
std::vector<std::string> warningMessages; std::string warningMessages;
if (!IsInitialBlockDownload()) if (!IsInitialBlockDownload())
{ {
int nUpgraded = 0; int nUpgraded = 0;
@ -2266,7 +2272,7 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
if (state == ThresholdState::ACTIVE) { if (state == ThresholdState::ACTIVE) {
DoWarning(strWarning); DoWarning(strWarning);
} else { } else {
warningMessages.push_back(strWarning); AppendWarning(warningMessages, strWarning);
} }
} }
} }
@ -2279,7 +2285,7 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
pindex = pindex->pprev; pindex = pindex->pprev;
} }
if (nUpgraded > 0) if (nUpgraded > 0)
warningMessages.push_back(strprintf(_("%d of last 100 blocks have unexpected version"), nUpgraded)); AppendWarning(warningMessages, strprintf(_("%d of last 100 blocks have unexpected version"), nUpgraded));
if (nUpgraded > 100/2) if (nUpgraded > 100/2)
{ {
std::string strWarning = _("Warning: Unknown block versions being mined! It's possible unknown rules are in effect"); std::string strWarning = _("Warning: Unknown block versions being mined! It's possible unknown rules are in effect");
@ -2293,7 +2299,7 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
FormatISO8601DateTime(pindexNew->GetBlockTime()), FormatISO8601DateTime(pindexNew->GetBlockTime()),
GuessVerificationProgress(chainParams.TxData(), pindexNew), pcoinsTip->DynamicMemoryUsage() * (1.0 / (1<<20)), pcoinsTip->GetCacheSize()); GuessVerificationProgress(chainParams.TxData(), pindexNew), pcoinsTip->DynamicMemoryUsage() * (1.0 / (1<<20)), pcoinsTip->GetCacheSize());
if (!warningMessages.empty()) if (!warningMessages.empty())
LogPrintf(" warning='%s'", boost::algorithm::join(warningMessages, ", ")); /* Continued */ LogPrintf(" warning='%s'", warningMessages); /* Continued */
LogPrintf("\n"); LogPrintf("\n");
} }

View file

@ -49,7 +49,6 @@ EXPECTED_BOOST_INCLUDES=(
boost/algorithm/string.hpp boost/algorithm/string.hpp
boost/algorithm/string/case_conv.hpp boost/algorithm/string/case_conv.hpp
boost/algorithm/string/classification.hpp boost/algorithm/string/classification.hpp
boost/algorithm/string/join.hpp
boost/algorithm/string/predicate.hpp boost/algorithm/string/predicate.hpp
boost/algorithm/string/replace.hpp boost/algorithm/string/replace.hpp
boost/algorithm/string/split.hpp boost/algorithm/string/split.hpp