Skip to content

Commit eeae471

Browse files
author
MarcoFalke
committed
Merge #13726: Utils and libraries: Removes the boost/algorithm/string/join dependency
5f019d5 Removes the boost/algorithm/string/join dependency (251) Pull request description: This commit removes the `boost/algorithm/string/join` dependency from the project by replacing `boost::algorithm::join` with the helper function proposed by @MarcoFalke in bitcoin/bitcoin#13726 (comment) Tree-SHA512: d4ba3e7621b76bd5210aec9b8d6c320f7ee963d7f902e6d2d3fc0eadbee1cd77799e5c09be9c11452d2825f25740fc436cdec3a6b6c66ced674d771e4ed306ae
2 parents 07ce278 + 5f019d5 commit eeae471

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/validation.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include <sstream>
4646

4747
#include <boost/algorithm/string/replace.hpp>
48-
#include <boost/algorithm/string/join.hpp>
4948
#include <boost/thread.hpp>
5049

5150
#if defined(NDEBUG)
@@ -2242,6 +2241,13 @@ static void DoWarning(const std::string& strWarning)
22422241
}
22432242
}
22442243

2244+
/** Private helper function that concatenates warning messages. */
2245+
static void AppendWarning(std::string& res, const std::string& warn)
2246+
{
2247+
if (!res.empty()) res += ", ";
2248+
res += warn;
2249+
}
2250+
22452251
/** Check warning conditions and do some notifications on new chain tip set. */
22462252
void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainParams) {
22472253
// New best block
@@ -2253,7 +2259,7 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
22532259
g_best_block_cv.notify_all();
22542260
}
22552261

2256-
std::vector<std::string> warningMessages;
2262+
std::string warningMessages;
22572263
if (!IsInitialBlockDownload())
22582264
{
22592265
int nUpgraded = 0;
@@ -2266,7 +2272,7 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
22662272
if (state == ThresholdState::ACTIVE) {
22672273
DoWarning(strWarning);
22682274
} else {
2269-
warningMessages.push_back(strWarning);
2275+
AppendWarning(warningMessages, strWarning);
22702276
}
22712277
}
22722278
}
@@ -2279,7 +2285,7 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
22792285
pindex = pindex->pprev;
22802286
}
22812287
if (nUpgraded > 0)
2282-
warningMessages.push_back(strprintf(_("%d of last 100 blocks have unexpected version"), nUpgraded));
2288+
AppendWarning(warningMessages, strprintf(_("%d of last 100 blocks have unexpected version"), nUpgraded));
22832289
if (nUpgraded > 100/2)
22842290
{
22852291
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
22932299
FormatISO8601DateTime(pindexNew->GetBlockTime()),
22942300
GuessVerificationProgress(chainParams.TxData(), pindexNew), pcoinsTip->DynamicMemoryUsage() * (1.0 / (1<<20)), pcoinsTip->GetCacheSize());
22952301
if (!warningMessages.empty())
2296-
LogPrintf(" warning='%s'", boost::algorithm::join(warningMessages, ", ")); /* Continued */
2302+
LogPrintf(" warning='%s'", warningMessages); /* Continued */
22972303
LogPrintf("\n");
22982304

22992305
}

test/lint/lint-includes.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ EXPECTED_BOOST_INCLUDES=(
4949
boost/algorithm/string.hpp
5050
boost/algorithm/string/case_conv.hpp
5151
boost/algorithm/string/classification.hpp
52-
boost/algorithm/string/join.hpp
5352
boost/algorithm/string/predicate.hpp
5453
boost/algorithm/string/replace.hpp
5554
boost/algorithm/string/split.hpp

0 commit comments

Comments
 (0)