Skip to content

Commit fea4e9e

Browse files
author
MarcoFalke
committed
Merge #13767: Remove redundant assignments (dead stores)
dd777f3 Remove unused variable (practicalswift) cdf4089 Remove redundant assignments (dead stores) (practicalswift) Pull request description: Remove redundant assignments (dead stores). Tree-SHA512: e852059b22a161c34a0f18a6a6ed798e2b35e6d2b9f23c526af0ec33e01f6a5bb1fa5ada6671ba183d7b02393ff0d397be5aa4b4e2edbd5e604c9a76ac48d249
2 parents dd34204 + dd777f3 commit fea4e9e

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

src/bench/crypto_hash.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,16 @@ static void SipHash_32b(benchmark::State& state)
8080
static void FastRandom_32bit(benchmark::State& state)
8181
{
8282
FastRandomContext rng(true);
83-
uint32_t x = 0;
8483
while (state.KeepRunning()) {
85-
x += rng.rand32();
84+
rng.rand32();
8685
}
8786
}
8887

8988
static void FastRandom_1bit(benchmark::State& state)
9089
{
9190
FastRandomContext rng(true);
92-
uint32_t x = 0;
9391
while (state.KeepRunning()) {
94-
x += rng.randbool();
92+
rng.randbool();
9593
}
9694
}
9795

src/bench/rollingbloom.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ static void RollingBloom(benchmark::State& state)
1212
CRollingBloomFilter filter(120000, 0.000001);
1313
std::vector<unsigned char> data(32);
1414
uint32_t count = 0;
15-
uint64_t match = 0;
1615
while (state.KeepRunning()) {
1716
count++;
1817
data[0] = count;
@@ -25,7 +24,7 @@ static void RollingBloom(benchmark::State& state)
2524
data[1] = count >> 16;
2625
data[2] = count >> 8;
2726
data[3] = count;
28-
match += filter.contains(data);
27+
filter.contains(data);
2928
}
3029
}
3130

src/test/descriptor_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void Check(const std::string& prv, const std::string& pub, int flags, const std:
6464
BOOST_CHECK_EQUAL(pub, pub2);
6565

6666
// Check that both can be serialized with private key back to the private version, but not without private key.
67-
std::string prv1, prv2;
67+
std::string prv1;
6868
BOOST_CHECK(parse_priv->ToPrivateString(keys_priv, prv1));
6969
BOOST_CHECK_EQUAL(prv, prv1);
7070
BOOST_CHECK(!parse_priv->ToPrivateString(keys_pub, prv1));

src/test/script_tests.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,17 +937,19 @@ BOOST_AUTO_TEST_CASE(script_build)
937937
}
938938
}
939939

940+
#ifdef UPDATE_JSON_TESTS
940941
std::string strGen;
941-
942+
#endif
942943
for (TestBuilder& test : tests) {
943944
test.Test();
944945
std::string str = JSONPrettyPrint(test.GetJSON());
945-
#ifndef UPDATE_JSON_TESTS
946+
#ifdef UPDATE_JSON_TESTS
947+
strGen += str + ",\n";
948+
#else
946949
if (tests_set.count(str) == 0) {
947950
BOOST_CHECK_MESSAGE(false, "Missing auto script_valid test: " + test.GetComment());
948951
}
949952
#endif
950-
strGen += str + ",\n";
951953
}
952954

953955
#ifdef UPDATE_JSON_TESTS

src/txmempool.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,19 +640,14 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
640640
innerUsage += memusage::DynamicUsage(links.parents) + memusage::DynamicUsage(links.children);
641641
bool fDependsWait = false;
642642
setEntries setParentCheck;
643-
int64_t parentSizes = 0;
644-
int64_t parentSigOpCost = 0;
645643
for (const CTxIn &txin : tx.vin) {
646644
// Check that every mempool transaction's inputs refer to available coins, or other mempool tx's.
647645
indexed_transaction_set::const_iterator it2 = mapTx.find(txin.prevout.hash);
648646
if (it2 != mapTx.end()) {
649647
const CTransaction& tx2 = it2->GetTx();
650648
assert(tx2.vout.size() > txin.prevout.n && !tx2.vout[txin.prevout.n].IsNull());
651649
fDependsWait = true;
652-
if (setParentCheck.insert(it2).second) {
653-
parentSizes += it2->GetTxSize();
654-
parentSigOpCost += it2->GetSigOpCost();
655-
}
650+
setParentCheck.insert(it2);
656651
} else {
657652
assert(pcoins->HaveCoin(txin.prevout));
658653
}

0 commit comments

Comments
 (0)