aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-05 08:28:29 +0200
committerMacroFake <falke.marco@gmail.com>2022-05-05 20:50:24 +0200
commitfa2deae2a86417d7e0d4cd33fb933b1000d20313 (patch)
tree949c81b62fd5399d478a28dcf0701f8d52ef2d96 /src/util
parentc367736f85ac7f63a63cbfa0bcc05a42277f04bc (diff)
downloadbitcoin-fa2deae2a86417d7e0d4cd33fb933b1000d20313.tar.xz
Wrap boost::replace_all
Diffstat (limited to 'src/util')
-rw-r--r--src/util/string.cpp7
-rw-r--r--src/util/string.h4
-rw-r--r--src/util/system.cpp3
3 files changed, 11 insertions, 3 deletions
diff --git a/src/util/string.cpp b/src/util/string.cpp
index 8ea3a1afc6..d05222e8b8 100644
--- a/src/util/string.cpp
+++ b/src/util/string.cpp
@@ -3,3 +3,10 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <util/string.h>
+
+#include <boost/algorithm/string/replace.hpp>
+
+void ReplaceAll(std::string& in_out, std::string_view search, std::string_view substitute)
+{
+ boost::replace_all(in_out, search, substitute);
+}
diff --git a/src/util/string.h b/src/util/string.h
index 2e91347b27..df20e34ae9 100644
--- a/src/util/string.h
+++ b/src/util/string.h
@@ -5,11 +5,11 @@
#ifndef BITCOIN_UTIL_STRING_H
#define BITCOIN_UTIL_STRING_H
-#include <attributes.h>
#include <util/spanparsing.h>
#include <algorithm>
#include <array>
+#include <cstdint>
#include <cstring>
#include <locale>
#include <sstream>
@@ -17,6 +17,8 @@
#include <string_view>
#include <vector>
+void ReplaceAll(std::string& in_out, std::string_view search, std::string_view substitute);
+
[[nodiscard]] inline std::vector<std::string> SplitString(std::string_view str, char sep)
{
return spanparsing::Split<std::string>(str, sep);
diff --git a/src/util/system.cpp b/src/util/system.cpp
index facf6855cb..44ebf5cb3e 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -76,7 +76,6 @@
#include <malloc.h>
#endif
-#include <boost/algorithm/string/replace.hpp>
#include <univalue.h>
#include <fstream>
@@ -1253,7 +1252,7 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
std::string ShellEscape(const std::string& arg)
{
std::string escaped = arg;
- boost::replace_all(escaped, "'", "'\"'\"'");
+ ReplaceAll(escaped, "'", "'\"'\"'");
return "'" + escaped + "'";
}
#endif