diff options
author | Alin Rus <alin@fsck.ro> | 2018-01-11 21:40:51 +0100 |
---|---|---|
committer | Alin Rus <alin@fsck.ro> | 2018-01-11 21:40:51 +0100 |
commit | a73aab7cd8343d795b1a7408bd71f522262ac76e (patch) | |
tree | 3e269a8f345cdd4ae3de43b277a11255295aa2ca /src/bitcoin-tx.cpp | |
parent | 1d2eaba300bc13c556e3cb05420dcc91ae12e1d0 (diff) |
Use the character based overload for std::string::find.
std::string::find has a character based overload as can be seen here
(4th oveload): http://www.cplusplus.com/reference/string/string/find/
Use that instead of constantly allocating temporary strings.
Diffstat (limited to 'src/bitcoin-tx.cpp')
-rw-r--r-- | src/bitcoin-tx.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 9bcf3fe8dd..f1cf7c9d2d 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -305,8 +305,8 @@ static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& str bool bScriptHash = false; if (vStrInputParts.size() == 3) { std::string flags = vStrInputParts[2]; - bSegWit = (flags.find("W") != std::string::npos); - bScriptHash = (flags.find("S") != std::string::npos); + bSegWit = (flags.find('W') != std::string::npos); + bScriptHash = (flags.find('S') != std::string::npos); } if (bSegWit) { @@ -367,8 +367,8 @@ static void MutateTxAddOutMultiSig(CMutableTransaction& tx, const std::string& s bool bScriptHash = false; if (vStrInputParts.size() == numkeys + 4) { std::string flags = vStrInputParts.back(); - bSegWit = (flags.find("W") != std::string::npos); - bScriptHash = (flags.find("S") != std::string::npos); + bSegWit = (flags.find('W') != std::string::npos); + bScriptHash = (flags.find('S') != std::string::npos); } else if (vStrInputParts.size() > numkeys + 4) { // Validate that there were no more parameters passed @@ -447,8 +447,8 @@ static void MutateTxAddOutScript(CMutableTransaction& tx, const std::string& str bool bScriptHash = false; if (vStrInputParts.size() == 3) { std::string flags = vStrInputParts.back(); - bSegWit = (flags.find("W") != std::string::npos); - bScriptHash = (flags.find("S") != std::string::npos); + bSegWit = (flags.find('W') != std::string::npos); + bScriptHash = (flags.find('S') != std::string::npos); } if (scriptPubKey.size() > MAX_SCRIPT_SIZE) { |