Skip to content

Commit bdea2bb

Browse files
committed
scripted-diff: Following the C++ Standard rules for identifiers with _.
Any identifier starting with two _, or one _ followed by a capital letter is reserved for the compiler and thus must not be used. See: https://stackoverflow.com/a/228797/7130273 -BEGIN VERIFY SCRIPT- s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; } s '__pushKV' 'pushKVEnd' s '_EraseTx' 'EraseTxNoLock' s '_Other' 'Other' -END VERIFY SCRIPT-
1 parent 8f40271 commit bdea2bb

File tree

13 files changed

+26
-26
lines changed

13 files changed

+26
-26
lines changed

src/common/settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ bool WriteSettings(const fs::path& path,
115115
{
116116
SettingsValue out(SettingsValue::VOBJ);
117117
for (const auto& value : values) {
118-
out.__pushKV(value.first, value.second);
118+
out.pushKVEnd(value.first, value.second);
119119
}
120120
std::ofstream file;
121121
file.open(path);

src/rpc/client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,10 @@ UniValue RPCConvertNamedValues(const std::string &strMethod, const std::vector<s
371371
}
372372

373373
if (!positional_args.empty()) {
374-
// Use __pushKV instead of pushKV to avoid overwriting an explicit
374+
// Use pushKVEnd instead of pushKV to avoid overwriting an explicit
375375
// "args" value with an implicit one. Let the RPC server handle the
376376
// request as given.
377-
params.__pushKV("args", positional_args);
377+
params.pushKVEnd("args", positional_args);
378378
}
379379

380380
return params;

src/rpc/mempool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ UniValue MempoolToJSON(const CTxMemPool& pool, bool verbose, bool include_mempoo
351351
entryToJSON(pool, info, e);
352352
// Mempool has unique entries so there is no advantage in using
353353
// UniValue::pushKV, which checks if the key already exists in O(N).
354-
// UniValue::__pushKV is used instead which currently is O(1).
355-
o.__pushKV(hash.ToString(), info);
354+
// UniValue::pushKVEnd is used instead which currently is O(1).
355+
o.pushKVEnd(hash.ToString(), info);
356356
}
357357
return o;
358358
} else {

src/rpc/server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ static inline JSONRPCRequest transformNamedArguments(const JSONRPCRequest& in, c
437437
if (options.exists(fr->first)) {
438438
throw JSONRPCError(RPC_INVALID_PARAMETER, "Parameter " + fr->first + " specified multiple times");
439439
}
440-
options.__pushKV(fr->first, *fr->second);
440+
options.pushKVEnd(fr->first, *fr->second);
441441
argsIn.erase(fr);
442442
}
443443
continue;

src/support/allocators/secure.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ struct secure_allocator : public std::allocator<T> {
3232
{
3333
}
3434
~secure_allocator() noexcept {}
35-
template <typename _Other>
35+
template <typename Other>
3636
struct rebind {
37-
typedef secure_allocator<_Other> other;
37+
typedef secure_allocator<Other> other;
3838
};
3939

4040
T* allocate(std::size_t n, const void* hint = nullptr)

src/support/allocators/zeroafterfree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ struct zero_after_free_allocator : public std::allocator<T> {
2727
{
2828
}
2929
~zero_after_free_allocator() noexcept {}
30-
template <typename _Other>
30+
template <typename Other>
3131
struct rebind {
32-
typedef zero_after_free_allocator<_Other> other;
32+
typedef zero_after_free_allocator<Other> other;
3333
};
3434

3535
void deallocate(T* p, std::size_t n)

src/test/settings_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ inline std::ostream& operator<<(std::ostream& os, const common::SettingsValue& v
3535
inline std::ostream& operator<<(std::ostream& os, const std::pair<std::string, common::SettingsValue>& kv)
3636
{
3737
common::SettingsValue out(common::SettingsValue::VOBJ);
38-
out.__pushKV(kv.first, kv.second);
38+
out.pushKVEnd(kv.first, kv.second);
3939
os << out.write();
4040
return os;
4141
}

src/txorphanage.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
5555
int TxOrphanage::EraseTx(const uint256& txid)
5656
{
5757
LOCK(m_mutex);
58-
return _EraseTx(txid);
58+
return EraseTxNoLock(txid);
5959
}
6060

61-
int TxOrphanage::_EraseTx(const uint256& txid)
61+
int TxOrphanage::EraseTxNoLock(const uint256& txid)
6262
{
6363
AssertLockHeld(m_mutex);
6464
std::map<uint256, OrphanTx>::iterator it = m_orphans.find(txid);
@@ -103,7 +103,7 @@ void TxOrphanage::EraseForPeer(NodeId peer)
103103
std::map<uint256, OrphanTx>::iterator maybeErase = iter++; // increment to avoid iterator becoming invalid
104104
if (maybeErase->second.fromPeer == peer)
105105
{
106-
nErased += _EraseTx(maybeErase->second.tx->GetHash());
106+
nErased += EraseTxNoLock(maybeErase->second.tx->GetHash());
107107
}
108108
}
109109
if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx from peer=%d\n", nErased, peer);
@@ -125,7 +125,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans)
125125
{
126126
std::map<uint256, OrphanTx>::iterator maybeErase = iter++;
127127
if (maybeErase->second.nTimeExpire <= nNow) {
128-
nErased += _EraseTx(maybeErase->second.tx->GetHash());
128+
nErased += EraseTxNoLock(maybeErase->second.tx->GetHash());
129129
} else {
130130
nMinExpTime = std::min(maybeErase->second.nTimeExpire, nMinExpTime);
131131
}
@@ -139,7 +139,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans)
139139
{
140140
// Evict a random orphan:
141141
size_t randompos = rng.randrange(m_orphan_list.size());
142-
_EraseTx(m_orphan_list[randompos]->first);
142+
EraseTxNoLock(m_orphan_list[randompos]->first);
143143
++nEvicted;
144144
}
145145
if (nEvicted > 0) LogPrint(BCLog::MEMPOOL, "orphanage overflow, removed %u tx\n", nEvicted);
@@ -231,7 +231,7 @@ void TxOrphanage::EraseForBlock(const CBlock& block)
231231
if (vOrphanErase.size()) {
232232
int nErased = 0;
233233
for (const uint256& orphanHash : vOrphanErase) {
234-
nErased += _EraseTx(orphanHash);
234+
nErased += EraseTxNoLock(orphanHash);
235235
}
236236
LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx included or conflicted by block\n", nErased);
237237
}

src/txorphanage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class TxOrphanage {
9999
std::map<uint256, OrphanMap::iterator> m_wtxid_to_orphan_it GUARDED_BY(m_mutex);
100100

101101
/** Erase an orphan by txid */
102-
int _EraseTx(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex);
102+
int EraseTxNoLock(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex);
103103
};
104104

105105
#endif // BITCOIN_TXORPHANAGE_H

src/univalue/include/univalue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class UniValue {
8787
template <class It>
8888
void push_backV(It first, It last);
8989

90-
void __pushKV(std::string key, UniValue val);
90+
void pushKVEnd(std::string key, UniValue val);
9191
void pushKV(std::string key, UniValue val);
9292
void pushKVs(UniValue obj);
9393

0 commit comments

Comments
 (0)