Skip to content

Commit fa95315

Browse files
author
MacroFake
committed
Use new Join() helper for ListBlockFilterTypes()
1 parent fa1c716 commit fa95315

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/blockfilter.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <mutex>
6-
#include <sstream>
76
#include <set>
87

98
#include <blockfilter.h>
@@ -13,6 +12,7 @@
1312
#include <script/script.h>
1413
#include <streams.h>
1514
#include <util/golombrice.h>
15+
#include <util/string.h>
1616

1717
/// SerType used to serialize parameters in GCS filter encoding.
1818
static constexpr int GCS_SER_TYPE = SER_NETWORK;
@@ -179,19 +179,7 @@ const std::set<BlockFilterType>& AllBlockFilterTypes()
179179

180180
const std::string& ListBlockFilterTypes()
181181
{
182-
static std::string type_list;
183-
184-
static std::once_flag flag;
185-
std::call_once(flag, []() {
186-
std::stringstream ret;
187-
bool first = true;
188-
for (const auto& entry : g_filter_types) {
189-
if (!first) ret << ", ";
190-
ret << entry.second;
191-
first = false;
192-
}
193-
type_list = ret.str();
194-
});
182+
static std::string type_list{Join(g_filter_types, ", ", [](const auto& entry) { return entry.second; })};
195183

196184
return type_list;
197185
}

0 commit comments

Comments
 (0)