mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-06 02:33:28 +01:00
refactor: introduce single-separator split helper SplitString
This helper uses spanparsing::Split internally and enables to replace all calls to boost::split where only a single separator is passed. Co-authored-by: Martin Ankerl <Martin.Ankerl@gmail.com> Co-authored-by: MarcoFalke <falke.marco@gmail.com>
This commit is contained in:
@@ -31,8 +31,6 @@
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
static bool fCreateBlank;
|
||||
static std::map<std::string,UniValue> registers;
|
||||
static const int CONTINUE_EXECUTION=-1;
|
||||
@@ -251,8 +249,7 @@ static T TrimAndParse(const std::string& int_str, const std::string& err)
|
||||
|
||||
static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInput)
|
||||
{
|
||||
std::vector<std::string> vStrInputParts;
|
||||
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
|
||||
std::vector<std::string> vStrInputParts = SplitString(strInput, ':');
|
||||
|
||||
// separate TXID:VOUT in string
|
||||
if (vStrInputParts.size()<2)
|
||||
@@ -287,8 +284,7 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu
|
||||
static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strInput)
|
||||
{
|
||||
// Separate into VALUE:ADDRESS
|
||||
std::vector<std::string> vStrInputParts;
|
||||
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
|
||||
std::vector<std::string> vStrInputParts = SplitString(strInput, ':');
|
||||
|
||||
if (vStrInputParts.size() != 2)
|
||||
throw std::runtime_error("TX output missing or too many separators");
|
||||
@@ -312,8 +308,7 @@ static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strIn
|
||||
static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& strInput)
|
||||
{
|
||||
// Separate into VALUE:PUBKEY[:FLAGS]
|
||||
std::vector<std::string> vStrInputParts;
|
||||
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
|
||||
std::vector<std::string> vStrInputParts = SplitString(strInput, ':');
|
||||
|
||||
if (vStrInputParts.size() < 2 || vStrInputParts.size() > 3)
|
||||
throw std::runtime_error("TX output missing or too many separators");
|
||||
@@ -356,8 +351,7 @@ static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& str
|
||||
static void MutateTxAddOutMultiSig(CMutableTransaction& tx, const std::string& strInput)
|
||||
{
|
||||
// Separate into VALUE:REQUIRED:NUMKEYS:PUBKEY1:PUBKEY2:....[:FLAGS]
|
||||
std::vector<std::string> vStrInputParts;
|
||||
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
|
||||
std::vector<std::string> vStrInputParts = SplitString(strInput, ':');
|
||||
|
||||
// Check that there are enough parameters
|
||||
if (vStrInputParts.size()<3)
|
||||
@@ -460,8 +454,7 @@ static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strIn
|
||||
static void MutateTxAddOutScript(CMutableTransaction& tx, const std::string& strInput)
|
||||
{
|
||||
// separate VALUE:SCRIPT[:FLAGS]
|
||||
std::vector<std::string> vStrInputParts;
|
||||
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
|
||||
std::vector<std::string> vStrInputParts = SplitString(strInput, ':');
|
||||
if (vStrInputParts.size() < 2)
|
||||
throw std::runtime_error("TX output missing separator");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user