From fc5ac139a14154d6c87f6f6df6cca5288b131565 Mon Sep 17 00:00:00 2001 From: svost Date: Tue, 11 Oct 2016 16:08:16 +0300 Subject: [PATCH] Remove boost replace_all function --- src/main.cpp | 9 ++++----- src/wallet.cpp | 11 +++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4f1d2d8..aa50e82 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include + #include "alert.h" #include "checkpoints.h" #include "db.h" @@ -11,7 +13,6 @@ #include "ui_interface.h" #include "checkqueue.h" #include "kernel.h" -#include #include #include @@ -2292,10 +2293,8 @@ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew) auto strCmd = GetArg("-blocknotify", ""); if (!fIsInitialDownload && !strCmd.empty()) - { - boost::replace_all(strCmd, "%s", hashBestChain.GetHex()); - boost::thread t(runCommand, strCmd); // thread runs free - } + // thread runs free + boost::thread t(runCommand, regex_replace(strCmd, static_cast("%s"), hashBestChain.GetHex())); return true; } diff --git a/src/wallet.cpp b/src/wallet.cpp index 5813953..d63db2a 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -3,6 +3,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include + #include "txdb.h" #include "wallet.h" #include "walletdb.h" @@ -11,7 +13,6 @@ #include "base58.h" #include "kernel.h" #include "coincontrol.h" -#include #include #include "main.h" @@ -784,11 +785,9 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn) // notify an external script when a wallet transaction comes in or is updated auto strCmd = GetArg("-walletnotify", ""); - if ( !strCmd.empty()) - { - boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex()); - boost::thread t(runCommand, strCmd); // thread runs free - } + if (!strCmd.empty()) + // thread runs free + boost::thread t(runCommand, regex_replace(strCmd, static_cast("%s"), wtxIn.GetHash().GetHex())); } return true; -- 1.7.1