Merge #20067: refactor: remove use of boost::algorithm::replace_first

6f4e393646 refactor: remove use of boost::algorithm::replace_first (Sebastian Falbesoner)

Pull request description:

  As discussed in #19851 (https://github.com/bitcoin/bitcoin/pull/19851#issuecomment-685424702), this trivial PR substitutes the (only) use of `boost::algorithm::replace_first` by a direct implementation.

ACKs for top commit:
  laanwj:
    Code review ACK 6f4e393646

Tree-SHA512: 2ef06498e19f864a4cbae10e8d1905e3440a2d1e8e5aae83de7597c23cdab92b4612d7fa1efbc49016e530debd127d1d50531c60ff159dbea0deaa8c836a2bfb
pull/679/head
Wladimir J. van der Laan 4 years ago
commit fbb2bee82d
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

@ -15,7 +15,6 @@
#include <version.h> #include <version.h>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include <algorithm> #include <algorithm>
@ -40,8 +39,9 @@ CScript ParseScript(const std::string& s)
continue; continue;
mapOpNames[strName] = static_cast<opcodetype>(op); mapOpNames[strName] = static_cast<opcodetype>(op);
// Convenience: OP_ADD and just ADD are both recognized: // Convenience: OP_ADD and just ADD are both recognized:
boost::algorithm::replace_first(strName, "OP_", ""); if (strName.compare(0, 3, "OP_") == 0) { // strName starts with "OP_"
mapOpNames[strName] = static_cast<opcodetype>(op); mapOpNames[strName.substr(3)] = static_cast<opcodetype>(op);
}
} }
} }

Loading…
Cancel
Save